[GH-ISSUE #419] ?allow for model files to be located in a different location than ~/.ollama? #46702

Closed
opened 2026-04-27 23:34:11 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @vegabook on GitHub (Aug 26, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/419

On my M2 mac, Ollama stores pulled models in ~/.ollama/models and its security keys in ~/.ollama. Is it possible to specify an alternative directory? My interest is in compartmentalizing ollama as much as possible into a single directory (happen to be using nix where ollama is available in the unstable channel, but that's an aside).

Originally created by @vegabook on GitHub (Aug 26, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/419 On my M2 mac, Ollama stores pulled models in `~/.ollama/models` and its security keys in `~/.ollama`. Is it possible to specify an alternative directory? My interest is in compartmentalizing ollama as much as possible into a single directory (happen to be using nix where [ollama is available in the unstable channel](https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=ollama), but that's an aside).
Author
Owner

@ivandir commented on GitHub (Aug 28, 2023):

Can we get a config file where we can tell ollama where the models are located?

<!-- gh-comment-id:1695804115 --> @ivandir commented on GitHub (Aug 28, 2023): Can we get a config file where we can tell ollama where the models are located?
Author
Owner

@vegabook commented on GitHub (Aug 28, 2023):

Can we get a config file where we can tell ollama where the models are located?

Small issue with config file is that now you still have (a small amount of) de-isolation because it's likely to be located in the ~/.config or somewhere else in the ~/. directory. That's still an improvement over the current ~/.ollama but ideal would be also to have an env variable available which overrides config and/or ollama directory location. Postgres for example does this with its PGDATA environment variable allowing for the service's files to be entirely contained in a subdirectory.

For one thing, this would allow for completely hermetical ollama nix flakes to be created, without resorting to config file writing from the flake which is a bit hackish.

<!-- gh-comment-id:1696365962 --> @vegabook commented on GitHub (Aug 28, 2023): > Can we get a config file where we can tell ollama where the models are located? Small issue with config file is that now you still have (a small amount of) de-isolation because it's likely to be located in the `~/.config` or somewhere else in the `~/.` directory. That's still an improvement over the current `~/.ollama` but ideal would be also to have an env variable available which overrides config and/or ollama directory location. Postgres for example does this with its `PGDATA` environment variable allowing for the service's files to be entirely contained in a subdirectory. For one thing, this would allow for completely hermetical ollama nix flakes to be created, without resorting to config file writing from the flake which is a bit hackish.
Author
Owner

@BruceMacD commented on GitHub (Aug 30, 2023):

Thanks for your feedback, this is on our radar. Consolidating this issue into #153 to keep things organized.

<!-- gh-comment-id:1699530362 --> @BruceMacD commented on GitHub (Aug 30, 2023): Thanks for your feedback, this is on our radar. Consolidating this issue into #153 to keep things organized.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#46702