A command-line tool for exporting and importing Ollama models.
go install github.com/fdkevin0/ollama_utils@latest
Or build locally:
go build -o ollama_utils .
Or use make:
make build
Export one or more models to a tar.gz archive:
# Export a single model (auto-generated filename)
./ollama_utils export llama3:latest
# Export a single model with custom filename
./ollama_utils export llama3:latest llama3-export.tar.gz
# Export multiple models (auto-generated filename)
./ollama_utils export llama3:latest phi3:latest
# Export multiple models with custom filename
./ollama_utils export llama3:latest phi3:latest models-export.tar.gz
# Export with custom Ollama directory
./ollama_utils export --ollama-dir /custom/ollama/models llama3:latest llama3-export.tar.gz
Import models from a tar.gz archive:
# Import models
./ollama_utils import models-export.tar.gz
# Import with custom Ollama directory
./ollama_utils import --ollama-dir /custom/ollama/models models-export.tar.gz
The tool automatically detects the default Ollama directory based on your OS:
- Linux/macOS:
$HOME/.ollama/models
- If
$HOME
cannot be determined:/usr/share/ollama/.ollama/models
You can override this with the --ollama-dir
flag.