> For the complete documentation index, see [llms.txt](https://www.techwithtyler.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.techwithtyler.dev/ai/running-llms-locally/ollama.md).

# Ollama

How to run LLMs locally with Ollama

## Installation

{% code overflow="wrap" %}

```bash
brew install ollama
```

{% endcode %}

## Uninstallation

{% hint style="danger" %}
Uninstalling ollama does not remove downloaded models!&#x20;
{% endhint %}

{% code overflow="wrap" %}

```zsh
brew uninstall ollama
```

{% endcode %}

{% code overflow="wrap" %}

```zsh
rm -rf ~/.ollama
```

{% endcode %}

***

## Running Ollama Server

* Once up and running, we can download and run models.&#x20;

{% code overflow="wrap" %}

```bash
ollama serve
```

{% endcode %}

* Stop the server by hitting `CTRL + C` or by closing the Terminal session&#x20;

***

## Discovering and Downloading Models

* Models are [viewable here](https://ollama.com/search)
* Models are downloaded here `~/.ollama/models/manifests/registry.ollama.ai/library/`

***

## Command Cheat Sheet

### List downloaded models

{% code overflow="wrap" %}

```bash
ollama list
```

{% endcode %}

### View running models

{% code overflow="wrap" %}

```bash
ollama ps 
```

{% endcode %}

### Running models

If the model isn't installed already, it will be downloaded

{% code overflow="wrap" %}

```bash
ollama run gemma3:27b
```

{% endcode %}

***

## Integrating with VS Code

{% hint style="warning" %}
Ollama must be running for this to work — `ollama serve`
{% endhint %}

<figure><img src="https://2721275171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8yu8YbDfwd1VqEdUxGyA%2Fuploads%2FFSubNHH7V2SBGfbK9gTy%2FCleanShot%202025-11-30%20at%2018.04.40%402x.png?alt=media&amp;token=90722c8c-84e6-4ecf-adfb-14e459abb2eb" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2721275171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8yu8YbDfwd1VqEdUxGyA%2Fuploads%2FZWBvS4cFOVj05DglGy8j%2FCleanShot%202025-11-30%20at%2018.05.54%402x.png?alt=media&amp;token=5823aa63-a5b9-4ab8-99e8-4919d1cd9bd7" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2721275171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8yu8YbDfwd1VqEdUxGyA%2Fuploads%2FRD34EdvHgNCAQ8snMlj3%2FCleanShot%202025-11-30%20at%2018.06.18%402x.png?alt=media&amp;token=2a161bb9-c22c-4fc1-8452-75f362013869" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2721275171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8yu8YbDfwd1VqEdUxGyA%2Fuploads%2Fd0PE15pQEyvEM4UYQwjt%2FCleanShot%202025-11-30%20at%2018.07.24%402x.png?alt=media&amp;token=dba7f032-6783-46ba-ad2d-8c7fb283509c" alt=""><figcaption></figcaption></figure>
