[GH-ISSUE #3639] MacOS not saving 0.0.0.0 between hardware restarts #48755

Closed
opened 2026-04-28 09:12:45 -05:00 by GiteaMirror · 12 comments
Owner

Originally created by @gwthompson on GitHub (Apr 14, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3639

What is the issue?

When I set launchctl setenv OLLAMA_HOST "0.0.0.0" and restart the Ollama ap everything works as expected and I can access the API from other devices on my network.

However when I reboot my Mac the OLLAMA_HOST reverts back to 127.0.0.1 and I have to run launchctl setenv OLLAMA_HOST "0.0.0.0" again.

What did you expect to see?

When I run launchctl setenv OLLAMA_HOST "0.0.0.0" and restart my Mac I expected the OLLAMA_HOST to still be set at 0.0.0.0

Steps to reproduce

  1. Run launchctl setenv OLLAMA_HOST "0.0.0.0"
  2. Restart Ollama App
  3. Check the logs to make sure it says "Listening on [::]:11434 (version 0.1.31)"
  4. Reboot the Mac
  5. Check the logs again and it now says "Listening on 127.0.0.1:11434 (version 0.1.31)"

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 @gwthompson on GitHub (Apr 14, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3639 ### What is the issue? When I set launchctl setenv OLLAMA_HOST "0.0.0.0" and restart the Ollama ap everything works as expected and I can access the API from other devices on my network. However when I reboot my Mac the OLLAMA_HOST reverts back to 127.0.0.1 and I have to run launchctl setenv OLLAMA_HOST "0.0.0.0" again. ### What did you expect to see? When I run launchctl setenv OLLAMA_HOST "0.0.0.0" and restart my Mac I expected the OLLAMA_HOST to still be set at 0.0.0.0 ### Steps to reproduce 1. Run launchctl setenv OLLAMA_HOST "0.0.0.0" 2. Restart Ollama App 3. Check the logs to make sure it says "Listening on [::]:11434 (version 0.1.31)" 4. Reboot the Mac 5. Check the logs again and it now says "Listening on 127.0.0.1:11434 (version 0.1.31)" ### 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 bugmacos labels 2026-04-28 09:12:45 -05:00
Author
Owner

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

That is correct...OLLAMA_HOST needs to be set after every boot. It is the expected behavior.

<!-- gh-comment-id:2054121854 --> @arsaboo commented on GitHub (Apr 14, 2024): That is correct...`OLLAMA_HOST` needs to be set after every boot. It is the expected behavior.
Author
Owner

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

I think we could improve the user experience by including some user configuration settings directly within the Ollama app for connecting to websites or Chrome extensions. That way upon a restart these configurations can be reapplied automatically.

https://github.com/ollama/ollama/issues/3598

<!-- gh-comment-id:2054132061 --> @dahjson commented on GitHub (Apr 14, 2024): I think we could improve the user experience by including some user configuration settings directly within the Ollama app for connecting to websites or Chrome extensions. That way upon a restart these configurations can be reapplied automatically. https://github.com/ollama/ollama/issues/3598
Author
Owner

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

In my particular scenario I am running the Ollama app on a standalone Mac mini and then accessing the API from other devices on both my internal network and my Tailscale network so ideally if the mini reboots for any reason it would have the 0.0.0.0 set properly.

I'm going to look into whether using a cron job to set the OLLAMA_HOST to 0.0.0.0 on reboot would solve my particular issue.

By the way OLLAMA is the best thing I've used in my LLM journey! Great work!

<!-- gh-comment-id:2054145466 --> @gwthompson commented on GitHub (Apr 14, 2024): In my particular scenario I am running the Ollama app on a standalone Mac mini and then accessing the API from other devices on both my internal network and my Tailscale network so ideally if the mini reboots for any reason it would have the 0.0.0.0 set properly. I'm going to look into whether using a cron job to set the OLLAMA_HOST to 0.0.0.0 on reboot would solve my particular issue. By the way OLLAMA is the best thing I've used in my LLM journey! Great work!
Author
Owner

@lin16303 commented on GitHub (May 22, 2024):

With a script open in the Script Editor app on your Mac, choose File > Export. Enter a name for the app. To save your app in a different location than shown, click the disclosure triangle, then select a folder. Click the File Format pop-up menu, then choose Application. Put the Application in the Open at login and get rid of Ollama

do shell script "launchctl setenv OLLAMA_HOST 0.0.0.0"
do shell script "OLLAMA_NUM_PARALLEL=2"
do shell script "OLLAMA_MAX_LOADED_MODELS=2"
do shell script "OLLAMA_KEEP_ALIVE=24h"
do shell script "open /Applications/ollama.app"

<!-- gh-comment-id:2124218699 --> @lin16303 commented on GitHub (May 22, 2024): With a script open in the Script Editor app on your Mac, choose File > Export. Enter a name for the app. To save your app in a different location than shown, click the disclosure triangle, then select a folder. Click the File Format pop-up menu, then choose Application. Put the Application in the Open at login and get rid of Ollama do shell script "launchctl setenv OLLAMA_HOST 0.0.0.0" do shell script "OLLAMA_NUM_PARALLEL=2" do shell script "OLLAMA_MAX_LOADED_MODELS=2" do shell script "OLLAMA_KEEP_ALIVE=24h" do shell script "open /Applications/ollama.app"
Author
Owner

@lizhen1412 commented on GitHub (Jun 2, 2024):

Is there a configuration file that can be changed to specify 0.0.0.0 directly?

<!-- gh-comment-id:2143750955 --> @lizhen1412 commented on GitHub (Jun 2, 2024): Is there a configuration file that can be changed to specify 0.0.0.0 directly?
Author
Owner

@tkoenig89 commented on GitHub (Jun 12, 2024):

For anyone coming here (like i did) because other settings were also reset after a reboot. I tried @lin16303 approach, which only worked half, so i modified it to have ollama be startet with keepAlive etc. configured:

do shell script "launchctl setenv OLLAMA_NUM_PARALLEL 2"
do shell script "launchctl setenv OLLAMA_MAX_LOADED_MODELS 2"
do shell script "launchctl setenv OLLAMA_KEEP_ALIVE 24h"
do shell script "open /Applications/ollama.app"

Setting the variables without launchctl did not work for me.

<!-- gh-comment-id:2162666711 --> @tkoenig89 commented on GitHub (Jun 12, 2024): For anyone coming here (like i did) because other settings were also reset after a reboot. I tried @lin16303 approach, which only worked half, so i modified it to have ollama be startet with keepAlive etc. configured: ```bash do shell script "launchctl setenv OLLAMA_NUM_PARALLEL 2" do shell script "launchctl setenv OLLAMA_MAX_LOADED_MODELS 2" do shell script "launchctl setenv OLLAMA_KEEP_ALIVE 24h" do shell script "open /Applications/ollama.app" ``` Setting the variables without launchctl did not work for me.
Author
Owner

@lizhen1412 commented on GitHub (Oct 6, 2024):

For anyone coming here (like i did) because other settings were also reset after a reboot. I tried @lin16303 approach, which only worked half, so i modified it to have ollama be startet with keepAlive etc. configured:

do shell script "launchctl setenv OLLAMA_NUM_PARALLEL 2"
do shell script "launchctl setenv OLLAMA_MAX_LOADED_MODELS 2"
do shell script "launchctl setenv OLLAMA_KEEP_ALIVE 24h"
do shell script "open /Applications/ollama.app"

Setting the variables without launchctl did not work for me.

Have you tried reinstalling it? In the new version, it seems that the OLLAMA_HOST variable can be configured only with sudo startup.

<!-- gh-comment-id:2395459970 --> @lizhen1412 commented on GitHub (Oct 6, 2024): > For anyone coming here (like i did) because other settings were also reset after a reboot. I tried @lin16303 approach, which only worked half, so i modified it to have ollama be startet with keepAlive etc. configured: > > ```shell > do shell script "launchctl setenv OLLAMA_NUM_PARALLEL 2" > do shell script "launchctl setenv OLLAMA_MAX_LOADED_MODELS 2" > do shell script "launchctl setenv OLLAMA_KEEP_ALIVE 24h" > do shell script "open /Applications/ollama.app" > ``` > > Setting the variables without launchctl did not work for me. Have you tried reinstalling it? In the new version, it seems that the OLLAMA_HOST variable can be configured only with sudo startup.
Author
Owner

@lin16303 commented on GitHub (Oct 7, 2024):

ollama.app.zip

For anyone coming here (like i did) because other settings were also reset after a reboot. I tried @lin16303 approach, which only worked half, so i modified it to have ollama be startet with keepAlive etc. configured:

do shell script "launchctl setenv OLLAMA_NUM_PARALLEL 2"
do shell script "launchctl setenv OLLAMA_MAX_LOADED_MODELS 2"
do shell script "launchctl setenv OLLAMA_KEEP_ALIVE 24h"
do shell script "open /Applications/ollama.app"

Setting the variables without launchctl did not work for me.

Have you tried reinstalling it? In the new version, it seems that the OLLAMA_HOST variable can be configured only with sudo startup.

ollama.app.zip
work with 0.3.12

<!-- gh-comment-id:2395761581 --> @lin16303 commented on GitHub (Oct 7, 2024): [ollama.app.zip](https://github.com/user-attachments/files/17271934/ollama.app.zip) > > For anyone coming here (like i did) because other settings were also reset after a reboot. I tried @lin16303 approach, which only worked half, so i modified it to have ollama be startet with keepAlive etc. configured: > > ```shell > > do shell script "launchctl setenv OLLAMA_NUM_PARALLEL 2" > > do shell script "launchctl setenv OLLAMA_MAX_LOADED_MODELS 2" > > do shell script "launchctl setenv OLLAMA_KEEP_ALIVE 24h" > > do shell script "open /Applications/ollama.app" > > ``` > > > > > > > > > > > > > > > > > > > > > > > > Setting the variables without launchctl did not work for me. > > Have you tried reinstalling it? In the new version, it seems that the OLLAMA_HOST variable can be configured only with sudo startup. [ollama.app.zip](https://github.com/user-attachments/files/17271937/ollama.app.zip) work with 0.3.12
Author
Owner

@jfbloom22 commented on GitHub (Apr 1, 2025):

this worked for me. Any idea how to set the default context-length?

<!-- gh-comment-id:2769259127 --> @jfbloom22 commented on GitHub (Apr 1, 2025): this worked for me. Any idea how to set the default context-length?
Author
Owner

@lizhen1412 commented on GitHub (Apr 1, 2025):

this worked for me. Any idea how to set the default context-length?

It should be in the source code.

<!-- gh-comment-id:2769265099 --> @lizhen1412 commented on GitHub (Apr 1, 2025): > this worked for me. Any idea how to set the default context-length? It should be in the source code.
Author
Owner

@jcastro commented on GitHub (Apr 1, 2025):

It's quite strange that we need to use a script to set this environment. Shouldn't there be a config file or something the app can read when starting?

<!-- gh-comment-id:2769393035 --> @jcastro commented on GitHub (Apr 1, 2025): It's quite strange that we need to use a script to set this environment. Shouldn't there be a config file or something the app can read when starting?
Author
Owner

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

I think we can close this out now that 0.9.4 has a settings UI to cover this capability which persists.

Image
<!-- gh-comment-id:3025843473 --> @dhiltgen commented on GitHub (Jul 1, 2025): I think we can close this out now that 0.9.4 has a settings UI to cover this capability which persists. <img width="650" alt="Image" src="https://github.com/user-attachments/assets/6656d225-f20d-404d-ae61-1b504f358977" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#48755