ollama icon indicating copy to clipboard operation
ollama copied to clipboard

How do you install the ollama gui and terminal executable from command line without manually installing it?

Open shyamalschandra opened this issue 11 months ago • 4 comments

What are you trying to do?

Automating the process of using the ollama package without going through the manual processing of installing it every time.

How should we solve this?

Make a brew that handles this -- brew install ollama -- is not enough.

What is the impact of not solving this?

It is going to cripple your users.

Anything else?

Please add more tuning parameters and hooks for developers from CLI and other languages like Swift and Python.

shyamalschandra avatar Mar 16 '24 22:03 shyamalschandra

Hi @shyamalschandra, as a workaround this is possible with some bash scripting, here is an example (that might need a bit of tweaking, but generally these are the steps):

#!/bin/bash

# Define GitHub API URL for Ollama releases
GITHUB_API_URL="https://api.github.com/repos/ollama/ollama/releases/latest"

# Use curl and jq to parse the JSON returned by GitHub API to find the download URL for Ollama-darwin.zip and ollama-darwin
OLLAMA_DARWIN_ZIP_URL=$(curl -s $GITHUB_API_URL | jq -r '.assets[] | select(.name | test("Ollama-darwin\\.zip$")) | .browser_download_url')
OLLAMA_DARWIN_BIN_URL=$(curl -s $GITHUB_API_URL | jq -r '.assets[] | select(.name | test("ollama-darwin$")) | .browser_download_url')

# Ensure the URLs were found
if [[ -z "$OLLAMA_DARWIN_ZIP_URL" || -z "$OLLAMA_DARWIN_BIN_URL" ]]; then
    echo "Failed to find the download URLs. Exiting..."
    exit 1
fi

# Download Ollama-darwin.zip
echo "Downloading Ollama-darwin.zip..."
curl -L $OLLAMA_DARWIN_ZIP_URL -o Ollama-darwin.zip

# Unzip Ollama-darwin.zip
echo "Unpacking Ollama-darwin.zip..."
unzip Ollama-darwin.zip

# Move the Ollama application to the user's Applications directory
echo "Moving Ollama application to the Applications directory..."
mv Ollama.app /Applications/

# Clean up the zip file
rm Ollama-darwin.zip

# Download ollama-darwin binary
echo "Downloading ollama-darwin binary..."
curl -L $OLLAMA_DARWIN_BIN_URL -o ollama-darwin

# Make the binary executable
chmod +x ollama-darwin

# Move the binary to /usr/local/bin/ollama
echo "Moving ollama-darwin to /usr/local/bin/ollama..."
sudo mv ollama-darwin /usr/local/bin/ollama

echo "Ollama installation complete."

Once #3240 goes in this should work pretty well.

BruceMacD avatar Mar 21 '24 10:03 BruceMacD

@BruceMacD: I will check if this works with zsh too. Zsh comes out of the box with MacOS and bash is secondary. I will try it.

shyamalschandra avatar Mar 22 '24 01:03 shyamalschandra

hi @BruceMacD: I just tried it and it gave some Javascript errors when it automatically ran the executable for ollama. I will investigate some more.

shyamalschandra avatar Mar 26 '24 21:03 shyamalschandra

Hi @BruceMacD, it like I will need more time to investigate. I will let you know as soon as I get time.

shyamalschandra avatar Mar 30 '24 18:03 shyamalschandra

hi @BruceMacD, it works perfectly now. Would you like to include it as a part of the ollama offering as a script when trying to install ollama from brew on mac intel?

shyamalschandra avatar Apr 15 '24 01:04 shyamalschandra

brew install --cask ollama seems to work, no?

quertc avatar Apr 15 '24 20:04 quertc