keypnchr

If you are running a Mac with at least an M1 processor (an M4 with 24GB of RAM handles these surprisingly well), and you were curious about running large language models locally on your machine, I have put together a guide to take you from start to finish on getting that up and running.

Open your terminal to a command prompt and get started below…

Prerequisites


1. Install Ollama

Ollama runs models locally and exposes an API on http://localhost:11434.

brew update
brew install ollama
brew services start ollama

The final command starts a background service listening on port 11434.

Verify it’s up and running:

ollama --version
curl http://localhost:11434/api/tags

The last command should return some JSON. If you don’t see an error, you should be good.


2. Pull some models

Download the model weights you want. Here are some examples:

## OpenAI Model
ollama pull gpt-oss
## Meta Model
ollama pull llama3
## Google Model
ollama pull gemma
## Mistral Model
ollama pull mistral:7b
## Multimodal Model (vision recognition and text)
ollama pull llava:7b

List your downloaded models:

ollama list

To remove an installed model:

ollama rm <model-name>

3. Install WebUI

WebUI provides a graphical browser interface to interact with the local Ollama server. Install with:

brew install python@3.12
brew install pipx
pipx ensurepath
pipx install --python /opt/homebrew/opt/python@3.12/bin/python3.12 open-webui

Run the following commands in your terminal to ensure the path needed for WebUI remains available (only needs to be done once):

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zprofile
source ~/.zprofile

4. Run a Model and Interact using WebUI

Choose a model to run (OpenAI’s gpt-oss in this example):

ollama run gpt-oss

Now, run WebUI. You will be prompted the first time you run it to set up an admin account:

open-webui serve

Open your browser to http://localhost:8080 (first launch will walk you through creating an admin user).

5. Optional: add aliases to your zsh terminal profile for easier access.

Edit your .zprofile:

nano ~/.zprofile

Add the following lines to your ~/.zprofile based on which LLMs you decide to install (be sure to add in the WebUI line at the bottom of the list; you can change Safari to another browser if you prefer):

alias gpt='ollama run gpt-oss'
alias llama='ollama run llama3'
alias gemma='ollama run gemma'
alias mistral='ollama run mistral:7b'
alias llava='ollama run llava:7b'

alias webui="open-webui serve & sleep 5 && open -a Safari http://localhost:8080"

Hit Ctrl+X to exit. Choose (Y)es to save the file, then enter to save as same file name.

After saving, reload the ZSH profile (you only have to do this once; each time you open a new terminal it will already be there):

source ~/.zprofile

Now you can quickly launch a model in the terminal, e.g.:

gpt

…and launch WebUI with:

webui

SPECIAL NOTE: there is a 5 second delay after running the WebUI command before it attempts to open the page in a browser (http://localhost:8080). If it has not finished starting in the terminal the page won’t load yet, but you can refresh the page when it is finished to begin.


6. Run on login (background services)

Ollama via Homebrew already runs as a service:

brew services start ollama
brew services stop ollama
brew services restart ollama

7. Troubleshooting

Reset/restart services

brew services restart ollama

What’s using a port (11434 or 8080)?

lsof -i :11434
lsof -i :8080

8. Uninstallation

Uninstall Ollama (Homebrew):

brew services stop ollama
brew uninstall ollama
rm -rf ~/.ollama

Uninstall Open WebUI (pipx):

pipx uninstall --python /opt/homebrew/opt/python@3.12/bin/python3.12 open-webui

9. Security & privacy notes


← Back to Writings