Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
scripts: add macOS support to install.sh (#14060)
Bruce MacDonald7ab4ca0e7f25
diff --git a/.github/workflows/test-install.yaml b/.github/workflows/test-install.yamlnew file mode 100644index 000000000..cecc1c30d--- /dev/null+++ b/.github/workflows/test-install.yaml@@ -0,0 +1,22 @@+name: test-install++on:+ pull_request:+ paths:+ - 'scripts/install.sh'+ - '.github/workflows/test-install.yaml'++jobs:+ test:+ strategy:+ matrix:+ os: [ubuntu-latest, macos-latest]+ runs-on: ${{ matrix.os }}+ steps:+ - uses: actions/checkout@v4+ - name: Run install script+ run: sh ./scripts/install.sh+ env:+ OLLAMA_NO_START: 1 # do not start app+ - name: Verify ollama is available+ run: ollama --versiondiff --git a/scripts/install.sh b/scripts/install.shindex 8e0b8ed8f..804db04df 100644--- a/scripts/install.sh+++ b/scripts/install.sh@@ -1,5 +1,5 @@#!/bin/sh-# This script installs Ollama on Linux.+# This script installs Ollama on Linux and macOS.# It detects the current operating system architecture and installs the appropriate version of Ollama.set -eu@@ -27,8 +27,7 @@ require() {echo $MISSING}-[ "$(uname -s)" = "Linux" ] || error 'This script is intended to run on Linux only.'-+OS="$(uname -s)"ARCH=$(uname -m)case "$ARCH" inx86_64) ARCH="amd64" ;;@@ -36,6 +35,65 @@ case "$ARCH" in*) error "Unsupported architecture: $ARCH" ;;esac+###########################################+# macOS+###########################################++if [ "$OS" = "Darwin" ]; then+ NEEDS=$(require curl unzip)+ if [ -n "$NEEDS" ]; then+ status "ERROR: The following tools are required but missing:"+ for NEED in $NEEDS; do+ echo " - $NEED"+ done+ exit 1+ fi++ if [ -n "${OLLAMA_VERSION:-}" ]; then+ DOWNLOAD_URL="https://github.com/ollama/ollama/releases/download/${OLLAMA_VERSION}/Ollama-darwin.zip"+ else+ DOWNLOAD_URL="https://github.com/ollama/ollama/releases/latest/download/Ollama-darwin.zip"+ fi++ if pgrep -x Ollama >/dev/null 2>&1; then+ status "Stopping running Ollama instance..."+ pkill -x Ollama 2>/dev/null || true+ sleep 2+ fi++ if [ -d "/Applications/Ollama.app" ]; then+ status "Removing existing Ollama installation..."+ rm -rf "/Applications/Ollama.app"+ fi++ status "Downloading Ollama for macOS..."+ curl --fail --show-error --location --progress-bar \+ -o "$TEMP_DIR/Ollama-darwin.zip" "$DOWNLOAD_URL"++ status "Installing Ollama to /Applications..."+ unzip -q "$TEMP_DIR/Ollama-darwin.zip" -d "$TEMP_DIR"+ mv "$TEMP_DIR/Ollama.app" "/Applications/"++ status "Adding 'ollama' command to PATH (may require password)..."+ mkdir -p "/usr/local/bin" 2>/dev/null || sudo mkdir -p "/usr/local/bin"+ ln -sf "/Applications/Ollama.app/Contents/Resources/ollama" "/usr/local/bin/ollama" 2>/dev/null || \+ sudo ln -sf "/Applications/Ollama.app/Contents/Resources/ollama" "/usr/local/bin/ollama"++ if [ -z "${OLLAMA_NO_START:-}" ]; then+ status "Starting Ollama..."+ open -a Ollama --args hidden+ fi++ status "Install complete. You can now run 'ollama'."+ exit 0+fi++###########################################+# Linux+###########################################++[ "$OS" = "Linux" ] || error 'This script is intended to run on Linux and macOS only.'+IS_WSL2=falseKERN=$(uname -r)