[GH-ISSUE #10724] envconfig: support config.env file for environment variables #7043

Open
opened 2026-04-12 18:57:14 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @davidstevens37 on GitHub (May 16, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/10724

Downloading Ollama via Brew and managing it's process with Brew services has made it a nuisance to expose Ollama to requester's that are not localhost/127.0.0.1.

In order to set the OLLAMA_HOST env variable, I've found that after each version upgrade, the homebrew.mxcl.ollama.plist needs to be updated to add include any relevant env variables, like OLLAMA_HOST.

Perhaps there's alternate ways to get Brew to recognize / persist environment variables, but I didn't have any luck getting that to take and persist.

Proposal:
add support for a config file in ~/.ollama/config.env. Environment variables can be set here, but will always be secondary if set as an environment variable. This provides a backwards compatible way to set relevant env variables when setting them in the environment is inconvenient and allows for setting them once.

# ~/.ollama/config.env
OLLAMA_HOST=0.0.0.0:11434
OLLAMA_KEEP_ALIVE=-1
Originally created by @davidstevens37 on GitHub (May 16, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/10724 Downloading Ollama via Brew and managing it's process with Brew services has made it a nuisance to expose Ollama to requester's that are not localhost/127.0.0.1. In order to set the OLLAMA_HOST env variable, I've found that after each version upgrade, the `homebrew.mxcl.ollama.plist` needs to be updated to add include any relevant env variables, like OLLAMA_HOST. Perhaps there's alternate ways to get Brew to recognize / persist environment variables, but I didn't have any luck getting that to take and persist. **Proposal:** add support for a config file in `~/.ollama/config.env`. Environment variables can be set here, but will always be secondary if set as an environment variable. This provides a backwards compatible way to set relevant env variables when setting them in the environment is inconvenient and allows for setting them once. ```bash # ~/.ollama/config.env OLLAMA_HOST=0.0.0.0:11434 OLLAMA_KEEP_ALIVE=-1 ```
GiteaMirror added the feature request label 2026-04-12 18:57:14 -05:00
Author
Owner

@joeytwiddle commented on GitHub (Oct 7, 2025):

I wonder if this can be solved on the homebrew side rather than with ollama. Perhaps homebrew could load the env vars before running ollama.

https://github.com/Homebrew/homebrew-core/blob/main/Formula/o/ollama.rb

I don't actually know where the .plist file comes from.

I can find it installed at /opt/homebrew/Cellar/ollama/0.12.3/homebrew.mxcl.ollama.plist

<!-- gh-comment-id:3376825773 --> @joeytwiddle commented on GitHub (Oct 7, 2025): I wonder if this can be solved on the homebrew side rather than with ollama. Perhaps homebrew could load the env vars before running ollama. https://github.com/Homebrew/homebrew-core/blob/main/Formula/o/ollama.rb I don't actually know where the `.plist` file comes from. I can find it installed at `/opt/homebrew/Cellar/ollama/0.12.3/homebrew.mxcl.ollama.plist`
Author
Owner

@muuvmuuv commented on GitHub (Jan 22, 2026):

Alternatively this works as well:

brew services stop ollama
launchctl setenv OLLAMA_KEEP_ALIVE 24h
brew services start ollama
<!-- gh-comment-id:3783374671 --> @muuvmuuv commented on GitHub (Jan 22, 2026): Alternatively this works as well: ``` brew services stop ollama launchctl setenv OLLAMA_KEEP_ALIVE 24h brew services start ollama ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#7043