[GH-ISSUE #3581] MacOS Ollama not binding to 0.0.0.0 #64250

Closed
opened 2026-05-03 16:44:57 -05:00 by GiteaMirror · 43 comments
Owner

Originally created by @kellerkind84 on GitHub (Apr 10, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3581

What is the issue?

So when set the OLLAMA_HOST to 0.0.0.0, I cannot access Ollama via the IP, but I can still access it via localhost.

What did you expect to see?

I expect it to be available under :11434

Steps to reproduce

No response

Are there any recent changes that introduced the issue?

No response

OS

macOS

Architecture

arm64

Platform

No response

Ollama version

0.1.31

GPU

Apple

GPU info

No response

CPU

Apple

Other software

No response

Originally created by @kellerkind84 on GitHub (Apr 10, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3581 ### What is the issue? So when set the OLLAMA_HOST to 0.0.0.0, I cannot access Ollama via the IP, but I can still access it via localhost. ### What did you expect to see? I expect it to be available under <myIP>:11434 ### Steps to reproduce _No response_ ### Are there any recent changes that introduced the issue? _No response_ ### OS macOS ### Architecture arm64 ### Platform _No response_ ### Ollama version 0.1.31 ### GPU Apple ### GPU info _No response_ ### CPU Apple ### Other software _No response_
GiteaMirror added the bug label 2026-05-03 16:44:57 -05:00
Author
Owner

@dims commented on GitHub (Apr 11, 2024):

Do you see this in your log?

time=2024-04-11T08:26:43.688-04:00 level=INFO source=routes.go:1139 msg="Listening on [::]:11434 (version 0.1.32-rc1)"
<!-- gh-comment-id:2049587156 --> @dims commented on GitHub (Apr 11, 2024): Do you see this in your log? ``` time=2024-04-11T08:26:43.688-04:00 level=INFO source=routes.go:1139 msg="Listening on [::]:11434 (version 0.1.32-rc1)" ```
Author
Owner

@kellerkind84 commented on GitHub (Apr 11, 2024):

I don't!

`❯ cat ~/.ollama/logs/server.log | grep -i listening
time=2024-04-10T21:12:53.994+02:00 level=INFO source=routes.go:1118 msg="Listening on 127.0.0.1:11434 (version 0.1.31)"
time=2024-04-10T21:14:45.409+02:00 level=INFO source=routes.go:1118 msg="Listening on 127.0.0.1:11434 (version 0.1.31)"
time=2024-04-10T21:17:09.948+02:00 level=INFO source=routes.go:1118 msg="Listening on 127.0.0.1:11434 (version 0.1.31)"
time=2024-04-10T21:31:55.355+02:00 level=INFO source=routes.go:1118 msg="Listening on 127.0.0.1:11434 (version 0.1.31)"

~
❯ echo $OLLAMA_HOST
0.0.0.0
`

I did the launchctl setenv thing, and I see the OLLAMA_HOST in any given terminal, but apart from that Ollama does not seem to care...

<!-- gh-comment-id:2049595244 --> @kellerkind84 commented on GitHub (Apr 11, 2024): I don't! `❯ cat ~/.ollama/logs/server.log | grep -i listening time=2024-04-10T21:12:53.994+02:00 level=INFO source=routes.go:1118 msg="Listening on 127.0.0.1:11434 (version 0.1.31)" time=2024-04-10T21:14:45.409+02:00 level=INFO source=routes.go:1118 msg="Listening on 127.0.0.1:11434 (version 0.1.31)" time=2024-04-10T21:17:09.948+02:00 level=INFO source=routes.go:1118 msg="Listening on 127.0.0.1:11434 (version 0.1.31)" time=2024-04-10T21:31:55.355+02:00 level=INFO source=routes.go:1118 msg="Listening on 127.0.0.1:11434 (version 0.1.31)" ~ ❯ echo $OLLAMA_HOST 0.0.0.0 ` I did the launchctl setenv thing, and I see the OLLAMA_HOST in any given terminal, but apart from that Ollama does not seem to care...
Author
Owner

@dims commented on GitHub (Apr 11, 2024):

restarted the server after running launchctl setenv OLLAMA_HOST "0.0.0.0" ?

<!-- gh-comment-id:2049707137 --> @dims commented on GitHub (Apr 11, 2024): restarted the server after running `launchctl setenv OLLAMA_HOST "0.0.0.0"` ?
Author
Owner

@kellerkind84 commented on GitHub (Apr 11, 2024):

Restarted the server and restarted my Mac.

<!-- gh-comment-id:2049738437 --> @kellerkind84 commented on GitHub (Apr 11, 2024): Restarted the server and restarted my Mac.
Author
Owner

@pdevine commented on GitHub (Apr 12, 2024):

@kellerkind84 is this working now? It's covered in the FAQ. As @dims mentioned, just:

  1. stop the ollama application;
  2. run launchctl setenv OLLAMA_HOST "0.0.0.0"
  3. restart ollama
  4. check in ~/.ollama/logs to see if "Listening on [::]:11434" is in one of the log files

Make sure you're looking in the last log file for step 4.

<!-- gh-comment-id:2052338405 --> @pdevine commented on GitHub (Apr 12, 2024): @kellerkind84 is this working now? It's covered in the [FAQ](https://github.com/ollama/ollama/blob/main/docs/faq.md#setting-environment-variables-on-mac). As @dims mentioned, just: 1. stop the ollama application; 2. run `launchctl setenv OLLAMA_HOST "0.0.0.0"` 3. restart ollama 4. check in `~/.ollama/logs` to see if "Listening on [::]:11434" is in one of the log files Make sure you're looking in the last log file for step 4.
Author
Owner

@kellerkind84 commented on GitHub (Apr 12, 2024):

What? Why would it be working now? I clearly stated twice that I did both steps and it does not work? Did you change something?

<!-- gh-comment-id:2052361741 --> @kellerkind84 commented on GitHub (Apr 12, 2024): What? Why would it be working now? I clearly stated twice that I did both steps and it does not work? Did you change something?
Author
Owner

@pdevine commented on GitHub (Apr 12, 2024):

@kellerkind84 no, it was unclear from your message. I just tried the steps and it works fine, so I'm having problems reproducing what you're seeing. What version of MacOS are you using?

<!-- gh-comment-id:2052470279 --> @pdevine commented on GitHub (Apr 12, 2024): @kellerkind84 no, it was unclear from your message. I just tried the steps and it works fine, so I'm having problems reproducing what you're seeing. What version of MacOS are you using?
Author
Owner

@arvindsg commented on GitHub (Apr 14, 2024):

@kellerkind84
Having a space after env variable can cause issues ollama starting on global interface
On windows this:-
'set OLLAMA_HOST=0.0.0.0:8080 && ollama serve'
fails with error Error: listen tcp: lookup tcp/8080 : unknown port

But explicitly setting variable using 'set OLLAMA_HOST=0.0.0.0:8080' and then ollama serve works properly

<!-- gh-comment-id:2053910227 --> @arvindsg commented on GitHub (Apr 14, 2024): @kellerkind84 Having a space after env variable can cause issues ollama starting on global interface On windows this:- 'set OLLAMA_HOST=0.0.0.0:8080 && ollama serve' fails with error Error: listen tcp: lookup tcp/8080 : unknown port But explicitly setting variable using 'set OLLAMA_HOST=0.0.0.0:8080' and then ollama serve works properly
Author
Owner

@kellerkind84 commented on GitHub (Apr 14, 2024):

Yeah that should not have happened. But these lines are a starting point to find out what is wrong... my default shell is not exactly standard. So I'll test from the command line, maybe I'll get some helpful output. On Monday, though.

<!-- gh-comment-id:2053913360 --> @kellerkind84 commented on GitHub (Apr 14, 2024): Yeah that should not have happened. But these lines are a starting point to find out what is wrong... my default shell is not exactly standard. So I'll test from the command line, maybe I'll get some helpful output. On Monday, though.
Author
Owner

@kellerkind84 commented on GitHub (Apr 15, 2024):

Alright, I had another look, fixed an error on my shell loading and even switched back to zsh. However, still not working when I start via the "app".

That said, simply running "ollama serve" works. Don't have to set the environment variable or anything.

It's an interesting workaround and working for now, but something does not work as expected here either way.

<!-- gh-comment-id:2055175231 --> @kellerkind84 commented on GitHub (Apr 15, 2024): Alright, I had another look, fixed an error on my shell loading and even switched back to zsh. However, still not working when I start via the "app". That said, simply running "ollama serve" works. Don't have to set the environment variable or anything. It's an interesting workaround and working for now, but something does not work as expected here either way.
Author
Owner

@gramata commented on GitHub (Apr 19, 2024):

I had the same issue.
Ollama on my mac mini stopped advertising the port 11434 to Tailscale.
I think it happened on upgrade from v0.1.31 to v0.1.32 as I was using ollama via tailscale without issue.

My setup is ollama installed via homebrew on m1 mac mini.
(fyi remember homebrew uses different directories for intel v apple silicon https://docs.brew.sh/Installation)

What seems to have worked for me is to update environment variable in:
/opt/homebrew/opt/ollama/homebrew.mxcl.ollama.plist

Steps I took that resolved issue:

  1. Check open ports with lsof -i -P | grep LISTEN
    In my case ollama was listed as TCP localhost:11434 (LISTEN)
    instead of the desired TCP *:11434 (LISTEN)

  2. update the homebrew.mxcl.ollama.plist:
    nano /opt/homebrew/opt/ollama/homebrew.mxcl.ollama.plist

Add the environment variable lines in plist format:

<key>EnvironmentVariables</key>
<dict>
    <key>OLLAMA_HOST</key>
    <string>0.0.0.0</string>
</dict>
  1. Restart ollama via brew services brew services restart ollama

On checking the open ports again it's now listed as desired TCP *:11434 (LISTEN)
Checking Tailscale admin page > machines (mac mini) > 'services' and port 11434 is now listed.

<!-- gh-comment-id:2065820641 --> @gramata commented on GitHub (Apr 19, 2024): I had the same issue. Ollama on my mac mini stopped advertising the port 11434 to Tailscale. I think it happened on upgrade from v0.1.31 to v0.1.32 as I was using ollama via tailscale without issue. My setup is ollama installed via homebrew on m1 mac mini. (fyi remember homebrew uses different directories for intel v apple silicon https://docs.brew.sh/Installation) What seems to have worked for me is to update environment variable in: `/opt/homebrew/opt/ollama/homebrew.mxcl.ollama.plist` ### Steps I took that resolved issue: 1. Check open ports with `lsof -i -P | grep LISTEN` In my case ollama was listed as `TCP localhost:11434 (LISTEN)` instead of the desired `TCP *:11434 (LISTEN)` 2. update the `homebrew.mxcl.ollama.plist`: `nano /opt/homebrew/opt/ollama/homebrew.mxcl.ollama.plist` Add the environment variable lines in plist format: ``` <key>EnvironmentVariables</key> <dict> <key>OLLAMA_HOST</key> <string>0.0.0.0</string> </dict> ``` 3. Restart ollama via brew services `brew services restart ollama` On checking the open ports again it's now listed as desired `TCP *:11434 (LISTEN)` Checking Tailscale admin page > machines (mac mini) > 'services' and port 11434 is now listed.
Author
Owner

@kellerkind84 commented on GitHub (Apr 22, 2024):

Thanks for the Tipp! I actually installed via download, but I might make the switch to homebrew. I was not even aware that ollama was available via homebrew.

<!-- gh-comment-id:2068993377 --> @kellerkind84 commented on GitHub (Apr 22, 2024): Thanks for the Tipp! I actually installed via download, but I might make the switch to homebrew. I was not even aware that ollama was available via homebrew.
Author
Owner

@kellerkind84 commented on GitHub (Apr 22, 2024):

Yeah that did the trick, thanks!

<!-- gh-comment-id:2069128843 --> @kellerkind84 commented on GitHub (Apr 22, 2024): Yeah that did the trick, thanks!
Author
Owner

@owenzhao commented on GitHub (Apr 22, 2024):

  1. Restart ollama via brew services brew services restart ollama

In my own experience, brew services restart ollama won't work again after Mac reboot. I have to brew services stop ollama first, then brew services start ollama to get the plist reloaded.

<!-- gh-comment-id:2069164198 --> @owenzhao commented on GitHub (Apr 22, 2024): > 3. Restart ollama via brew services `brew services restart ollama` In my own experience, `brew services restart ollama` won't work again after Mac reboot. I have to `brew services stop ollama` first, then `brew services start ollama` to get the plist reloaded.
Author
Owner

@pdevine commented on GitHub (Apr 30, 2024):

I'm going to go ahead and close this since there is a workaround. There are some changes coming for the mac version which will let you set this through a setting by clicking on the tray icon which should make everything a lot easier.

<!-- gh-comment-id:2086713447 --> @pdevine commented on GitHub (Apr 30, 2024): I'm going to go ahead and close this since there is a workaround. There are some changes coming for the mac version which will let you set this through a setting by clicking on the tray icon which should make everything a lot easier.
Author
Owner

@owenzhao commented on GitHub (Apr 30, 2024):

I'm going to go ahead and close this since there is a workaround. There are some changes coming for the mac version which will let you set this through a setting by clicking on the tray icon which should make everything a lot easier.

There are two ollamas in brew, only the cask version has the menu icon(tray).

<!-- gh-comment-id:2087323356 --> @owenzhao commented on GitHub (Apr 30, 2024): > I'm going to go ahead and close this since there is a workaround. There are some changes coming for the mac version which will let you set this through a setting by clicking on the tray icon which should make everything a lot easier. There are two ollamas in brew, only the cask version has the menu icon(tray).
Author
Owner

@finder39 commented on GitHub (May 30, 2024):

I'm going to go ahead and close this since there is a workaround. There are some changes coming for the mac version which will let you set this through a setting by clicking on the tray icon which should make everything a lot easier.

Is there something we can track for that? It may be worth creating an "issue" with a feature request for it so we can subscribe to it

<!-- gh-comment-id:2138603071 --> @finder39 commented on GitHub (May 30, 2024): > I'm going to go ahead and close this since there is a workaround. There are some changes coming for the mac version which will let you set this through a setting by clicking on the tray icon which should make everything a lot easier. Is there something we can track for that? It may be worth creating an "issue" with a feature request for it so we can subscribe to it
Author
Owner

@tediorelee commented on GitHub (Jul 15, 2024):

Hi is this bug still exists? I downloaded Ollama from website and directly install it, but seems like it still does not listen "0.0.0.0" even if I tried to use "launchctl setenv OLLAMA_HOST "0.0.0.0""

<!-- gh-comment-id:2227899552 --> @tediorelee commented on GitHub (Jul 15, 2024): Hi is this bug still exists? I downloaded Ollama from website and directly install it, but seems like it still does not listen "0.0.0.0" even if I tried to use "launchctl setenv OLLAMA_HOST "0.0.0.0""
Author
Owner

@kellerkind84 commented on GitHub (Jul 15, 2024):

I think so, yes... my ollama does not bind to 0.0.0.0 anymore.

<!-- gh-comment-id:2227908671 --> @kellerkind84 commented on GitHub (Jul 15, 2024): I think so, yes... my ollama does not bind to 0.0.0.0 anymore.
Author
Owner

@jmadden91 commented on GitHub (Jul 15, 2024):

Same problem here. I'd prefer not to use homebrew if possible

<!-- gh-comment-id:2228113399 --> @jmadden91 commented on GitHub (Jul 15, 2024): Same problem here. I'd prefer not to use homebrew if possible
Author
Owner

@gramata commented on GitHub (Aug 8, 2024):

It seems that with every update to ollama (cli version) via homebrew the plist /opt/homebrew/opt/ollama/homebrew.mxcl.ollama.plist is overwritten.
I have to do the work around I mention above after each update.
If anyone finds a persistent solution that would be helpful.

<!-- gh-comment-id:2274734587 --> @gramata commented on GitHub (Aug 8, 2024): It seems that with every update to ollama (cli version) via homebrew the plist `/opt/homebrew/opt/ollama/homebrew.mxcl.ollama.plist` is overwritten. I have to do the work around I mention above after each update. If anyone finds a persistent solution that would be helpful.
Author
Owner

@owenzhao commented on GitHub (Aug 9, 2024):

For those who are still trying to reopen this issue. Please read and try this first.

<!-- gh-comment-id:2277598498 --> @owenzhao commented on GitHub (Aug 9, 2024): For those who are still trying to reopen this issue. Please read and try [this](https://github.com/ollama/ollama/blob/main/docs/faq.md) first.
Author
Owner

@kolewu commented on GitHub (Oct 5, 2024):

For those who are still trying to reopen this issue. Please read and try this first.

Wow: The whole issue is, that exactly this is not working for 0.3.12.

So it's not solved and there is no issue linked to track the solution. Very sad.

<!-- gh-comment-id:2395116821 --> @kolewu commented on GitHub (Oct 5, 2024): > For those who are still trying to reopen this issue. Please read and try [this](https://github.com/ollama/ollama/blob/main/docs/faq.md) first. Wow: The whole issue is, that exactly this is not working for 0.3.12. So it's not solved and there is no issue linked to track the solution. Very sad.
Author
Owner

@kolewu commented on GitHub (Nov 29, 2024):

With 0.4.6 it's working now.

But beware, the command launchctl setenv OLLAMA_HOST 0.0.0.0 has to be executed in the same session (or whatevever it is called on MacOS) as the ollama application. It's not enough, to be the same user. So you have to use the desktop terminal app and not for example a ssh session to enter the command!

<!-- gh-comment-id:2507495061 --> @kolewu commented on GitHub (Nov 29, 2024): With 0.4.6 it's working now. But beware, the command `launchctl setenv OLLAMA_HOST 0.0.0.0` has to be executed in the same session (or whatevever it is called on MacOS) as the ollama application. It's not enough, to be the same user. So you have to use the desktop terminal app and not for example a ssh session to enter the command!
Author
Owner

@kolewu commented on GitHub (Nov 29, 2024):

Because I am a very curious person, I installed version 0.3.12 again and lo and behold, it works there too. So I most likely did not execute the launchctl command on the desktop during testing, but in the ssh session.

So, to be clear, both with 0.3.12 and with the current version 0.4.6, the server binds to the address set with launchctl for the environment variable OLLAMA_HOST if (and only if) the launchctl command is executed in the same context as the application, i.e. in a terminal running in the desktop environment. This is only for the current session and not permanent!

It seems not to be easy, to permanently set the variable. The best I could find for now is this guide: MacOS Environment Variables

<!-- gh-comment-id:2507567711 --> @kolewu commented on GitHub (Nov 29, 2024): Because I am a very curious person, I installed version 0.3.12 again and lo and behold, it works there too. So I most likely did not execute the launchctl command on the desktop during testing, but in the ssh session. So, to be clear, both with 0.3.12 and with the current version 0.4.6, the server binds to the address set with launchctl for the environment variable `OLLAMA_HOST` if (and only if) the launchctl command is executed in the same context as the application, i.e. in a terminal running in the desktop environment. This is only for the current session and not permanent! It seems not to be easy, to permanently set the variable. The best I could find for now is this guide: [MacOS Environment Variables](https://docs.derivative.ca/MacOS_Environment_Variables)
Author
Owner

@JYDAG commented on GitHub (Nov 29, 2024):

The real problem is that ollama, installed via Homebrew, can't set the environment variable using launchctl setenv OLLAMA_HOST 0.0.0.0, above https://github.com/ollama/ollama/issues/3581#issuecomment-2065820641 I tried that too, but it doesn't work, it seems that ollama is separate from the services managed by Homebrew.

<!-- gh-comment-id:2507655620 --> @JYDAG commented on GitHub (Nov 29, 2024): The real problem is that ollama, installed via Homebrew, can't set the environment variable using `launchctl setenv OLLAMA_HOST 0.0.0.0`, above https://github.com/ollama/ollama/issues/3581#issuecomment-2065820641 I tried that too, but it doesn't work, it seems that ollama is separate from the services managed by Homebrew.
Author
Owner

@kolewu commented on GitHub (Nov 29, 2024):

I have not examined the homebrew installation, but would think that ollama is either not installed as a launchd agent/daemon or in a different "session"; for example in the system session, but I don't know the systemctl launchctl incantation for another session. So you have to look into the start process for the homebrew installation and find out how to set the environment variable for this specific case.

<!-- gh-comment-id:2508001938 --> @kolewu commented on GitHub (Nov 29, 2024): I have not examined the homebrew installation, but would think that ollama is either not installed as a launchd agent/daemon or in a different "session"; for example in the system session, but I don't know the ~`systemctl`~ `launchctl` incantation for another session. So you have to look into the start process for the homebrew installation and find out how to set the environment variable for this specific case.
Author
Owner

@aghea commented on GitHub (Dec 4, 2024):

You can try to launch Ollama at startup after a delay.

Step 1: Create a launch daemon plist
Step 2: Copy the file to two locations:
/Library/LaunchDaemons/
~/Library/LaunchAgents/
mac os will automatic add this to startup items.

Step 3: To launch Ollama after a 10 second delay, Open Script Editor and create the simple AppleScript file

delay 10
tell application "Ollama" to run

In the File menu choose Export, and then export it as type “Application” and name it “LaunchOllamaDelay”. Save it to your user Applications folder.

In System Settings go to Login Items and add the LaunchOllamaDelay application to the startup items. Also remove any existing Ollama startup item.

Now when you restart and sign in, Ollama will launch after 10 seconds which should be enough time for the Launch Agent to have executed. And if Ollama updates itself in the future it should also just work when it restarts.

It's work on sequoia

<!-- gh-comment-id:2516193704 --> @aghea commented on GitHub (Dec 4, 2024): You can try to launch Ollama at startup after a delay. Step 1: Create a launch daemon plist Step 2: Copy the file to two locations: /Library/LaunchDaemons/ ~/Library/LaunchAgents/ mac os will automatic add this to startup items. Step 3: To launch Ollama after a 10 second delay, Open Script Editor and create the simple AppleScript file _delay 10 tell application "Ollama" to run_ In the File menu choose Export, and then export it as type “**Application**” and name it “**LaunchOllamaDelay**”. Save it to your user _Applications folder_. In System Settings go to Login Items and add the LaunchOllamaDelay application to the startup items. _Also remove any existing Ollama startup item._ Now when you restart and sign in, Ollama will launch after 10 seconds which should be enough time for the Launch Agent to have executed. And if Ollama updates itself in the future it should also just work when it restarts. It's work on sequoia
Author
Owner

@venuswjx commented on GitHub (Dec 12, 2024):

Below is an AppleScript example that sets the OLLAMA_HOST environment variable first and then launches Ollama after a 10-second delay.

Steps
Create the AppleScript
Open the Script Editor application on your Mac, paste the following script:

applescript

-- Set the environment variable
do shell script "launchctl setenv OLLAMA_HOST \"0.0.0.0\""

-- Wait for 10 seconds, allowing the environment variable to take effect and the system to stabilize
delay 10

-- Launch Ollama
tell application "Ollama" to run

Export as an Application
Go to File > Export..., then:

Set the "File Format" to "Application".
Name it something like LaunchOllamaWithEnvDelay.
Save it in your ~/Applications folder or any other convenient location.
Add to Login Items
Open System Settings (or System Preferences on older macOS versions):

Click on General (if using System Settings) and then Login Items.
Click the + button and select the LaunchOllamaWithEnvDelay.app you just created.

<!-- gh-comment-id:2537899634 --> @venuswjx commented on GitHub (Dec 12, 2024): Below is an AppleScript example that sets the OLLAMA_HOST environment variable first and then launches Ollama after a 10-second delay. Steps Create the AppleScript Open the Script Editor application on your Mac, paste the following script: applescript ~~~~~~ -- Set the environment variable do shell script "launchctl setenv OLLAMA_HOST \"0.0.0.0\"" -- Wait for 10 seconds, allowing the environment variable to take effect and the system to stabilize delay 10 -- Launch Ollama tell application "Ollama" to run ~~~~~~ Export as an Application Go to File > Export..., then: Set the "File Format" to "Application". Name it something like LaunchOllamaWithEnvDelay. Save it in your ~/Applications folder or any other convenient location. Add to Login Items Open System Settings (or System Preferences on older macOS versions): Click on General (if using System Settings) and then Login Items. Click the + button and select the LaunchOllamaWithEnvDelay.app you just created.
Author
Owner

@Hk-Gosuto commented on GitHub (Dec 14, 2024):

guys, try this.
https://github.com/hschmidt/EnvPane

<!-- gh-comment-id:2542998431 --> @Hk-Gosuto commented on GitHub (Dec 14, 2024): guys, try this. https://github.com/hschmidt/EnvPane
Author
Owner

@afeiship commented on GitHub (Jan 21, 2025):

This worked for me(Apple M2 14.6.1)!

export OLLAMA_HOST=http://0.0.0.0:11434;
<!-- gh-comment-id:2603676247 --> @afeiship commented on GitHub (Jan 21, 2025): ✅ This worked for me(Apple M2 14.6.1)! ```shell export OLLAMA_HOST=http://0.0.0.0:11434; ```
Author
Owner

@pippo73 commented on GitHub (Jan 21, 2025):

Hi all,
Sorry if I'm too rookie but it is the firs time I'm using a MacOS device.
I'm using a brand new Mac Mini M4.
I've installed brew and then ollama.
As many of you I'm not able to set ollama to listen on a address different then 127.0.0.1 :-(

this are the data I can give:

% brew services start ollama -d
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading ollama
==> /bin/launchctl print gui/501/homebrew.mxcl.ollama

==> Successfully started `ollama` (label: homebrew.mxcl.ollama)

 % brew services info ollama -d
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading ollama
==> /bin/launchctl list homebrew.mxcl.ollama
{
        "StandardOutPath" = "/opt/homebrew/var/log/ollama.log";
        "LimitLoadToSessionType" = "Aqua";
        "StandardErrorPath" = "/opt/homebrew/var/log/ollama.log";
        "Label" = "homebrew.mxcl.ollama";
        "OnDemand" = false;
        "LastExitStatus" = 0;
        "PID" = 24901;
        "Program" = "/opt/homebrew/opt/ollama/bin/ollama";
        "ProgramArguments" = (
                "/opt/homebrew/opt/ollama/bin/ollama";
                "serve";
        );
};
ollama (homebrew.mxcl.ollama)
Running: ✔
Loaded: ✔
Schedulable: ✘
User: MyUser
PID: 24901
% cat /opt/homebrew/opt/ollama/homebrew.mxcl.ollama.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
       <key>KeepAlive</key>
       <true/>
       <key>Label</key>
       <string>homebrew.mxcl.ollama</string>
       <key>LimitLoadToSessionType</key>
       <array>
               <string>Aqua</string>
               <string>Background</string>
               <string>LoginWindow</string>
               <string>StandardIO</string>
               <string>System</string>
       </array>
       <key>ProgramArguments</key>
       <array>
               <string>/opt/homebrew/opt/ollama/bin/ollama</string>
               <string>serve</string>
       </array>
       <key>RunAtLoad</key>
       <true/>
       <key>StandardErrorPath</key>
       <string>/opt/homebrew/var/log/ollama.log</string>
       <key>StandardOutPath</key>
       <string>/opt/homebrew/var/log/ollama.log</string>
       <key>WorkingDirectory</key>
       <string>/opt/homebrew/var</string>
       <key>OLLAMA_HOST</key>
       <string>0.0.0.0</string>
</dict>
</plist>


% tail -f /opt/homebrew/var/log/ollama.log
time=2025-01-21T19:17:37.390+01:00 level=INFO source=images.go:439 msg="total unused blobs removed: 0"
time=2025-01-21T19:17:37.390+01:00 level=INFO source=routes.go:1238 msg="Listening on 127.0.0.1:11434 (version 0.5.7)"
time=2025-01-21T19:17:37.391+01:00 level=INFO source=routes.go:1267 msg="Dynamic LLM libraries" runners=[metal]
time=2025-01-21T19:17:37.407+01:00 level=INFO source=types.go:131 msg="inference compute" id=0 library=metal variant="" compute="" driver=0.0 name="" total="21.3 GiB" available="21.3 GiB"
2025/01/21 19:18:22 routes.go:1187: INFO server config env="map[HTTPS_PROXY: HTTP_PROXY: NO_PROXY: OLLAMA_DEBUG:false OLLAMA_FLASH_ATTENTION:false OLLAMA_GPU_OVERHEAD:0 OLLAMA_HOST:http://127.0.0.1:11434 OLLAMA_KEEP_ALIVE:5m0s OLLAMA_KV_CACHE_TYPE: OLLAMA_LLM_LIBRARY: OLLAMA_LOAD_TIMEOUT:5m0s OLLAMA_MAX_LOADED_MODELS:0 OLLAMA_MAX_QUEUE:512 OLLAMA_MODELS:/Users/MyUser/.ollama/models OLLAMA_MULTIUSER_CACHE:false OLLAMA_NOHISTORY:false OLLAMA_NOPRUNE:false OLLAMA_NUM_PARALLEL:0 OLLAMA_ORIGINS:[http://localhost https://localhost http://localhost:* https://localhost:* http://127.0.0.1 https://127.0.0.1 http://127.0.0.1:* https://127.0.0.1:* http://0.0.0.0 https://0.0.0.0 http://0.0.0.0:* https://0.0.0.0:* app://* file://* tauri://* vscode-webview://*] OLLAMA_SCHED_SPREAD:false http_proxy: https_proxy: no_proxy:]"
time=2025-01-21T19:18:22.341+01:00 level=INFO source=images.go:432 msg="total blobs: 6"
time=2025-01-21T19:18:22.342+01:00 level=INFO source=images.go:439 msg="total unused blobs removed: 0"
time=2025-01-21T19:18:22.342+01:00 level=INFO source=routes.go:1238 msg="Listening on 127.0.0.1:11434 (version 0.5.7)"
time=2025-01-21T19:18:22.342+01:00 level=INFO source=routes.go:1267 msg="Dynamic LLM libraries" runners=[metal]
time=2025-01-21T19:18:22.358+01:00 level=INFO source=types.go:131 msg="inference compute" id=0 library=metal variant="" compute="" driver=0.0 name="" total="21.3 GiB" available="21.3 GiB"

Now I dont know what else I can do?!

Update
I'm sorry, that I've misread the previosu message of @afeiship , the

export OLLAMA_HOST=http://0.0.0.0:11434;

seems to work for me too.

The only thing is that I don't understand how to make it persistent, since, if I reboot the system, I have to re-set the value.
To start ollama at the boot of the device I've used the following command:

% brew services start ollama -d

But this way I still have the problem on who to pass the export command?

<!-- gh-comment-id:2605463517 --> @pippo73 commented on GitHub (Jan 21, 2025): Hi all, Sorry if I'm too rookie but it is the firs time I'm using a MacOS device. I'm using a brand new Mac Mini M4. I've installed brew and then ollama. As many of you I'm not able to set ollama to listen on a address different then 127.0.0.1 :-( this are the data I can give: ``` % brew services start ollama -d /opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading ollama ==> /bin/launchctl print gui/501/homebrew.mxcl.ollama ==> Successfully started `ollama` (label: homebrew.mxcl.ollama) ``` ``` % brew services info ollama -d /opt/homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading ollama ==> /bin/launchctl list homebrew.mxcl.ollama { "StandardOutPath" = "/opt/homebrew/var/log/ollama.log"; "LimitLoadToSessionType" = "Aqua"; "StandardErrorPath" = "/opt/homebrew/var/log/ollama.log"; "Label" = "homebrew.mxcl.ollama"; "OnDemand" = false; "LastExitStatus" = 0; "PID" = 24901; "Program" = "/opt/homebrew/opt/ollama/bin/ollama"; "ProgramArguments" = ( "/opt/homebrew/opt/ollama/bin/ollama"; "serve"; ); }; ollama (homebrew.mxcl.ollama) Running: ✔ Loaded: ✔ Schedulable: ✘ User: MyUser PID: 24901 ``` ``` % cat /opt/homebrew/opt/ollama/homebrew.mxcl.ollama.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <true/> <key>Label</key> <string>homebrew.mxcl.ollama</string> <key>LimitLoadToSessionType</key> <array> <string>Aqua</string> <string>Background</string> <string>LoginWindow</string> <string>StandardIO</string> <string>System</string> </array> <key>ProgramArguments</key> <array> <string>/opt/homebrew/opt/ollama/bin/ollama</string> <string>serve</string> </array> <key>RunAtLoad</key> <true/> <key>StandardErrorPath</key> <string>/opt/homebrew/var/log/ollama.log</string> <key>StandardOutPath</key> <string>/opt/homebrew/var/log/ollama.log</string> <key>WorkingDirectory</key> <string>/opt/homebrew/var</string> <key>OLLAMA_HOST</key> <string>0.0.0.0</string> </dict> </plist> ``` ``` % tail -f /opt/homebrew/var/log/ollama.log time=2025-01-21T19:17:37.390+01:00 level=INFO source=images.go:439 msg="total unused blobs removed: 0" time=2025-01-21T19:17:37.390+01:00 level=INFO source=routes.go:1238 msg="Listening on 127.0.0.1:11434 (version 0.5.7)" time=2025-01-21T19:17:37.391+01:00 level=INFO source=routes.go:1267 msg="Dynamic LLM libraries" runners=[metal] time=2025-01-21T19:17:37.407+01:00 level=INFO source=types.go:131 msg="inference compute" id=0 library=metal variant="" compute="" driver=0.0 name="" total="21.3 GiB" available="21.3 GiB" 2025/01/21 19:18:22 routes.go:1187: INFO server config env="map[HTTPS_PROXY: HTTP_PROXY: NO_PROXY: OLLAMA_DEBUG:false OLLAMA_FLASH_ATTENTION:false OLLAMA_GPU_OVERHEAD:0 OLLAMA_HOST:http://127.0.0.1:11434 OLLAMA_KEEP_ALIVE:5m0s OLLAMA_KV_CACHE_TYPE: OLLAMA_LLM_LIBRARY: OLLAMA_LOAD_TIMEOUT:5m0s OLLAMA_MAX_LOADED_MODELS:0 OLLAMA_MAX_QUEUE:512 OLLAMA_MODELS:/Users/MyUser/.ollama/models OLLAMA_MULTIUSER_CACHE:false OLLAMA_NOHISTORY:false OLLAMA_NOPRUNE:false OLLAMA_NUM_PARALLEL:0 OLLAMA_ORIGINS:[http://localhost https://localhost http://localhost:* https://localhost:* http://127.0.0.1 https://127.0.0.1 http://127.0.0.1:* https://127.0.0.1:* http://0.0.0.0 https://0.0.0.0 http://0.0.0.0:* https://0.0.0.0:* app://* file://* tauri://* vscode-webview://*] OLLAMA_SCHED_SPREAD:false http_proxy: https_proxy: no_proxy:]" time=2025-01-21T19:18:22.341+01:00 level=INFO source=images.go:432 msg="total blobs: 6" time=2025-01-21T19:18:22.342+01:00 level=INFO source=images.go:439 msg="total unused blobs removed: 0" time=2025-01-21T19:18:22.342+01:00 level=INFO source=routes.go:1238 msg="Listening on 127.0.0.1:11434 (version 0.5.7)" time=2025-01-21T19:18:22.342+01:00 level=INFO source=routes.go:1267 msg="Dynamic LLM libraries" runners=[metal] time=2025-01-21T19:18:22.358+01:00 level=INFO source=types.go:131 msg="inference compute" id=0 library=metal variant="" compute="" driver=0.0 name="" total="21.3 GiB" available="21.3 GiB" ``` Now I dont know what else I can do?! Update I'm sorry, that I've misread the previosu message of @afeiship , the `export OLLAMA_HOST=http://0.0.0.0:11434;` seems to work for me too. The only thing is that I don't understand how to make it persistent, since, if I reboot the system, I have to re-set the value. To start ollama at the boot of the device I've used the following command: ``` % brew services start ollama -d ``` But this way I still have the problem on who to pass the **export** command?
Author
Owner

@afeiship commented on GitHub (Jan 30, 2025):

@pippo73 add this line to .zshrc or .bashrc file

export OLLAMA_HOST=http://0.0.0.0:11434;
<!-- gh-comment-id:2624818011 --> @afeiship commented on GitHub (Jan 30, 2025): @pippo73 add this line to `.zshrc` or `.bashrc` file ```sh export OLLAMA_HOST=http://0.0.0.0:11434; ```
Author
Owner

@appsfinder2 commented on GitHub (Feb 3, 2025):

guys, try this. https://github.com/hschmidt/EnvPane

ive installed this how do I add ollama too it? sorry newbie

<!-- gh-comment-id:2630381695 --> @appsfinder2 commented on GitHub (Feb 3, 2025): > guys, try this. https://github.com/hschmidt/EnvPane ive installed this how do I add ollama too it? sorry newbie
Author
Owner

@Hk-Gosuto commented on GitHub (Feb 4, 2025):

guys, try this. https://github.com/hschmidt/EnvPane

ive installed this how do I add ollama too it? sorry newbie

Add OLLAMA_HOST value is 0.0.0.0 and restart ollama

You can use the command launchctl getenv OLLAMA_HOST verify that the configuration is successful

Image Image
<!-- gh-comment-id:2632769278 --> @Hk-Gosuto commented on GitHub (Feb 4, 2025): > > guys, try this. https://github.com/hschmidt/EnvPane > > ive installed this how do I add ollama too it? sorry newbie Add `OLLAMA_HOST` value is `0.0.0.0` and restart ollama You can use the command `launchctl getenv OLLAMA_HOST` verify that the configuration is successful <img width="920" alt="Image" src="https://github.com/user-attachments/assets/700aa15d-e8ba-4db4-9985-90c375378375" /> <img width="288" alt="Image" src="https://github.com/user-attachments/assets/f8fc808b-b3f3-4bef-8fa4-486faa7b6386" />
Author
Owner

@TiantingShi commented on GitHub (Feb 24, 2025):

1. Check Port Occupancy

Use the lsof command to check the occupancy of port 11434:

% lsof -i :11434

The output shows that ollama is only listening on localhost for port 11434.

2. Modify the .plist File

Add the OLLAMA_HOST environment variable in the .plist file to allow ollama to listen on all network interfaces:

% cat com.ollama.plist 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.ollama</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/ollama</string>
        <string>serve</string>
    </array>
    <key>EnvironmentVariables</key>
    <dict>
        <key>OLLAMA_HOST</key>
        <string>0.0.0.0</string>
    </dict>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
</dict>
</plist>

3. Load and Reload the Service

Use launchctl to load and reload the LaunchDaemons service:

% sudo launchctl bootstrap system /xxx/com.ollama.plist

4. Unload and Reload the Service

To ensure the service is correctly loaded, first unload and then reload it:

% sudo launchctl unload /xxx/com.ollama.plist
% sudo launchctl bootstrap system /xxx/com.ollama.plist

5. Check File Permissions

Ensure that the .plist file has the correct permissions and ownership:

% sudo ls -l /xxx/com.ollama.plist

6. Check Service Status

Finally, check the service status to confirm it is running normally:

% launchctl list com.ollama

7. Use sudo launchctl load Command (Optional)

If necessary, you can also use the sudo launchctl load command to load the service:

% sudo launchctl load /xxx/com.ollama.plist

Summary

By following these steps, you can ensure that the ollama service correctly listens on all network interfaces and is managed using launchctl. The main steps include checking port occupancy, modifying the .plist file, loading and reloading the service, checking file permissions, and viewing service status. I hope these steps are helpful!

<!-- gh-comment-id:2679884195 --> @TiantingShi commented on GitHub (Feb 24, 2025): ### 1. Check Port Occupancy Use the `lsof` command to check the occupancy of port 11434: ```sh % lsof -i :11434 ``` The output shows that `ollama` is only listening on `localhost` for port 11434. ### 2. Modify the `.plist` File Add the `OLLAMA_HOST` environment variable in the `.plist` file to allow `ollama` to listen on all network interfaces: ```xml % cat com.ollama.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.ollama</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/ollama</string> <string>serve</string> </array> <key>EnvironmentVariables</key> <dict> <key>OLLAMA_HOST</key> <string>0.0.0.0</string> </dict> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/> </dict> </plist> ``` ### 3. Load and Reload the Service Use `launchctl` to load and reload the `LaunchDaemons` service: ```sh % sudo launchctl bootstrap system /xxx/com.ollama.plist ``` ### 4. Unload and Reload the Service To ensure the service is correctly loaded, first unload and then reload it: ```sh % sudo launchctl unload /xxx/com.ollama.plist % sudo launchctl bootstrap system /xxx/com.ollama.plist ``` ### 5. Check File Permissions Ensure that the `.plist` file has the correct permissions and ownership: ```sh % sudo ls -l /xxx/com.ollama.plist ``` ### 6. Check Service Status Finally, check the service status to confirm it is running normally: ```sh % launchctl list com.ollama ``` ### 7. Use `sudo launchctl load` Command (Optional) If necessary, you can also use the `sudo launchctl load` command to load the service: ```sh % sudo launchctl load /xxx/com.ollama.plist ``` ### Summary By following these steps, you can ensure that the `ollama` service correctly listens on all network interfaces and is managed using `launchctl`. The main steps include checking port occupancy, modifying the `.plist` file, loading and reloading the service, checking file permissions, and viewing service status. I hope these steps are helpful!
Author
Owner

@kutayzorlu commented on GitHub (Mar 8, 2025):

'set OLLAMA_HOST=0.0.0.0:8080 && ollama serve'

works for me on MAC ARM
listens multi interface :
localhost : ......

  • : ......
<!-- gh-comment-id:2708296708 --> @kutayzorlu commented on GitHub (Mar 8, 2025): 'set OLLAMA_HOST=0.0.0.0:8080 && ollama serve' works for me on MAC ARM listens multi interface : localhost : ...... * : ......
Author
Owner

@elcolie commented on GitHub (Mar 25, 2025):

ollama version is 0.6.2
OSX: 15.3.2 (24D81)
.zshrc has this export OLLAMA_HOST=http://0.0.0.0:11434;
Not work.

<!-- gh-comment-id:2750605055 --> @elcolie commented on GitHub (Mar 25, 2025): ollama version is 0.6.2 OSX: 15.3.2 (24D81) `.zshrc` has this `export OLLAMA_HOST=http://0.0.0.0:11434;` Not work.
Author
Owner

@elcolie commented on GitHub (Mar 25, 2025):

Found the solution.
https://github.com/ollama/ollama/issues/8304
OLLAMA_HOST=http://0.0.0.0:11434 ollama serve

<!-- gh-comment-id:2750640281 --> @elcolie commented on GitHub (Mar 25, 2025): Found the solution. https://github.com/ollama/ollama/issues/8304 OLLAMA_HOST=http://0.0.0.0:11434 ollama serve
Author
Owner

@duchu commented on GitHub (Apr 2, 2025):

I have ollama installed through brew.sh and it is run by brew services. I have the same problem with setting OLLAMA_HOST, does anyone know how to deal with it?

<!-- gh-comment-id:2772739960 --> @duchu commented on GitHub (Apr 2, 2025): I have ollama installed through brew.sh and it is run by brew services. I have the same problem with setting OLLAMA_HOST, does anyone know how to deal with it?
Author
Owner

@duchu commented on GitHub (Apr 6, 2025):

I have ollama installed through brew.sh and it is run by brew services. I have the same problem with setting OLLAMA_HOST, does anyone know how to deal with it?

The steps shown on this comment worked for me.

It seems to me that this solution will be overwritten when updating Ollam by brew.sh

<!-- gh-comment-id:2781478300 --> @duchu commented on GitHub (Apr 6, 2025): > > I have ollama installed through brew.sh and it is run by brew services. I have the same problem with setting OLLAMA_HOST, does anyone know how to deal with it? > > The steps shown on [this comment](https://github.com/ollama/ollama/issues/3581#issuecomment-2679884195) worked for me. It seems to me that this solution will be overwritten when updating Ollam by brew.sh
Author
Owner

@leandrofavarin commented on GitHub (Jun 11, 2025):

I had the same issue. Ollama on my mac mini stopped advertising the port 11434 to Tailscale. I think it happened on upgrade from v0.1.31 to v0.1.32 as I was using ollama via tailscale without issue.

My setup is ollama installed via homebrew on m1 mac mini. (fyi remember homebrew uses different directories for intel v apple silicon https://docs.brew.sh/Installation)

What seems to have worked for me is to update environment variable in: /opt/homebrew/opt/ollama/homebrew.mxcl.ollama.plist

Steps I took that resolved issue:

  1. Check open ports with lsof -i -P | grep LISTEN
    In my case ollama was listed as TCP localhost:11434 (LISTEN)
    instead of the desired TCP *:11434 (LISTEN)
  2. update the homebrew.mxcl.ollama.plist:
    nano /opt/homebrew/opt/ollama/homebrew.mxcl.ollama.plist

Add the environment variable lines in plist format:

<key>EnvironmentVariables</key>
<dict>
    <key>OLLAMA_HOST</key>
    <string>0.0.0.0</string>
</dict>
  1. Restart ollama via brew services brew services restart ollama

On checking the open ports again it's now listed as desired TCP *:11434 (LISTEN) Checking Tailscale admin page > machines (mac mini) > 'services' and port 11434 is now listed.

Great help, thanks for sharing! One question: whenever you get an Ollama update through homebrew, you have to edit and put back the environment variable on homebrew.mxcl.ollama.plist, right? That's what I am doing, but I wish I didn't have to.

<!-- gh-comment-id:2962663394 --> @leandrofavarin commented on GitHub (Jun 11, 2025): > I had the same issue. Ollama on my mac mini stopped advertising the port 11434 to Tailscale. I think it happened on upgrade from v0.1.31 to v0.1.32 as I was using ollama via tailscale without issue. > > My setup is ollama installed via homebrew on m1 mac mini. (fyi remember homebrew uses different directories for intel v apple silicon https://docs.brew.sh/Installation) > > What seems to have worked for me is to update environment variable in: `/opt/homebrew/opt/ollama/homebrew.mxcl.ollama.plist` > > ### Steps I took that resolved issue: > > 1. Check open ports with `lsof -i -P | grep LISTEN` > In my case ollama was listed as `TCP localhost:11434 (LISTEN)` > instead of the desired `TCP *:11434 (LISTEN)` > 2. update the `homebrew.mxcl.ollama.plist`: > `nano /opt/homebrew/opt/ollama/homebrew.mxcl.ollama.plist` > > Add the environment variable lines in plist format: > > ``` > <key>EnvironmentVariables</key> > <dict> > <key>OLLAMA_HOST</key> > <string>0.0.0.0</string> > </dict> > ``` > > 3. Restart ollama via brew services `brew services restart ollama` > > On checking the open ports again it's now listed as desired `TCP *:11434 (LISTEN)` Checking Tailscale admin page > machines (mac mini) > 'services' and port 11434 is now listed. Great help, thanks for sharing! One question: whenever you get an Ollama update through homebrew, you have to edit and put back the environment variable on `homebrew.mxcl.ollama.plist`, right? That's what I am doing, but I wish I didn't have to.
Author
Owner

@dhiltgen commented on GitHub (Jul 3, 2025):

The latest version of the Mac app now has a configuration screen that makes it much simpler to enable exposing the Ollama on your local network.

Image
<!-- gh-comment-id:3033954357 --> @dhiltgen commented on GitHub (Jul 3, 2025): The latest version of the Mac app now has a configuration screen that makes it much simpler to enable exposing the Ollama on your local network. <img width="588" alt="Image" src="https://github.com/user-attachments/assets/9b2ac304-bd3f-44a4-8540-e35b73249d75" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#64250