# 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="/files/xmVR8CZlVQuwRZ14jErL" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/iPOZ6j8qWar7Nk5h3YE6" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/CkAyE4WXR7AqBO7cEM8O" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/iDt6Bq2j84T0hDOmrmPN" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.techwithtyler.dev/ai/running-llms-locally/ollama.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
