Skip to content

Instantly share code, notes, and snippets.

@imaitland
Last active September 9, 2024 18:37
Show Gist options
  • Save imaitland/4408f82852c41484712c287b778f07f8 to your computer and use it in GitHub Desktop.
Save imaitland/4408f82852c41484712c287b778f07f8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Get the absolute path of the script
SCRIPT_PATH="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
# Set OLLAMA_MODELS environment variable
export OLLAMA_MODELS="$SCRIPT_PATH/models"
# Add SCRIPT_PATH/bin/ollama to the PATH if it's not already included
OLLAMA_BIN="$SCRIPT_PATH/bin"
if [[ ":$PATH:" != *":$OLLAMA_BIN:"* ]]; then
export PATH="$PATH:$OLLAMA_BIN"
echo "Added $OLLAMA_BIN to PATH"
else
echo "$OLLAMA_BIN is already in PATH"
fi
# Print information
echo "ollama added to system PATH, run 'ollama serve' to get started"
echo "ollama will look for models in: $OLLAMA_MODELS"
@imaitland
Copy link
Author

s/o @ryanhausen for this script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment