> 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/lm-studio.md).

# LM Studio

How to run LLMs locally with LM Studio

## Overview

* LM Studio provides a way to run LLMs locally on your machine
* It's similar to [Ollama](/ai/running-llms-locally/ollama.md)but provides a GUI interface making it more user-friendly and also similar in style to ChatGPT

***

## Installation

{% code overflow="wrap" %}

```bash
brew install lm-studio
```

{% endcode %}

***

## Running LM Studio

{% hint style="warning" %}
These models are loaded into your system's memory (RAM) when in `READY` state so be cognizant of usage
{% endhint %}

* Open the app and hit `CMD + L` to select a model to use
* Then wait for the model to load i.e., `READY` state

<figure><img src="https://2721275171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8yu8YbDfwd1VqEdUxGyA%2Fuploads%2FjusWSbOZyMyChN1RN9rq%2FCleanShot%202025-11-30%20at%2018.41.59%402x.png?alt=media&amp;token=905e44c5-585e-45cd-85da-e12b56c685b9" alt=""><figcaption></figcaption></figure>

* Click the `Eject` button (seen above) to unload the model from memory

***

## Discovering and Downloading Models

* Models are downloaded from [Hugging Face](https://huggingface.co/)
* Models are downloaded here `~/.lmstudio/models/`
* Open the app and hit `CMD + SHIFT + M`&#x20;

<figure><img src="https://2721275171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8yu8YbDfwd1VqEdUxGyA%2Fuploads%2F9BBPrIw16H5GoAsRRzT5%2FCleanShot%202025-11-30%20at%2018.49.43%402x.png?alt=media&amp;token=cd661390-3375-4c60-b89e-8dd6272975b0" alt=""><figcaption></figcaption></figure>

* By selecting the below option, we can ensure models will fit on our device (based on memory)

<figure><img src="https://2721275171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8yu8YbDfwd1VqEdUxGyA%2Fuploads%2FlydRCHhfkYhAPaPMZ8CN%2FCleanShot%202025-11-30%20at%2018.50.38%402x.png?alt=media&amp;token=f6cb7bee-1989-42cb-b301-14de30365ebb" alt=""><figcaption></figcaption></figure>

***

## Integrating with VS Code

### Start LM Studio Server

<figure><img src="https://2721275171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8yu8YbDfwd1VqEdUxGyA%2Fuploads%2FLJb8lIovZwOCqAIQz9ys%2FCleanShot%202025-11-30%20at%2019.14.29%402x.png?alt=media&amp;token=e650e738-830d-4e4c-a7b0-2a094008b3c3" alt=""><figcaption></figcaption></figure>

***

### Install VS Code Extension, Continue

* The most straightforward way I've found is by installing the [VS Code extension, continue](https://marketplace.visualstudio.com/items?itemName=Continue.continue)&#x20;
* While this is a 3rd-party coding assistant, the extension is open-source and we can entirely leverage our local LLMs without signing up for this service

<figure><img src="https://2721275171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8yu8YbDfwd1VqEdUxGyA%2Fuploads%2FpFfjLJEsjc75k8LkhlwQ%2FCleanShot%202025-11-30%20at%2019.13.24%402x.png?alt=media&amp;token=54070f82-07e9-45e4-9cf9-dff66ff9b8b0" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2721275171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8yu8YbDfwd1VqEdUxGyA%2Fuploads%2FkmsD85tfaElpDq5dFKw4%2FCleanShot%202025-11-30%20at%2019.10.36%402x.png?alt=media&amp;token=25b4104a-188d-4181-8806-415408232925" alt=""><figcaption></figcaption></figure>

* Open up a file e.g. `main.tf` and hit `CTRL + I`&#x20;
* This opens the chat window on the side where you can type in what you want the LLM to write for you

<figure><img src="https://2721275171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8yu8YbDfwd1VqEdUxGyA%2Fuploads%2FaXmp0j8RTWheDGWaWyXS%2FCleanShot%202025-11-30%20at%2019.16.42%402x.png?alt=media&amp;token=94c0b5a5-514f-4b2b-9b85-59797e28ef5a" alt=""><figcaption></figcaption></figure>
