Using the LM Studio Command Line Interface (CLI)
While the LM Studio UI application is convenient to use for chatting, using LM Studio as a RAG system, etc., the command line interface is also useful because a command line interface (CLI) is often a much faster way to get work done.
You can refer to the official documentation https://lmstudio.ai/docs/cli. Here we will look at a few examples:
lms ls
1 $ lms ls
2
3 You have 6 models, taking up 46.44 GB of disk space.
4
5 LLMs (Large Language Models) PARAMS ARCHITECTURE SIZE
6 qwen3moe 13.29 GB
7 qwen3-30b-a3b-instruct-2507-mlx qwen3_moe 17.19 GB
8 qwen/qwen3-30b-a3b-2507 qwen3_moe 17.19 GB
9 google/gemma-4-12b-qat gemma4 8.07 GB ✓ LOADED
10 liquid/lfm2-1.2b lfm2 1.25 GB
11
12 Embedding Models PARAMS ARCHITECTURE SIZE
13 text-embedding-nomic-embed-text-v1.5 Nomic BERT 84.11 MB
lms load <model_key>
A model key is the first item displayed on an output line when you run lms ls.
1 $ lms load google/gemma-4-12b-qat
2
3 Loading model "google/gemma-4-12b-qat"...
4 Model loaded successfully in 13.59s. (8.07 GB)
5 To use the model in the API/SDK, use the identifier "google/gemma-4-12b-qat:2".
6 To set a custom identifier, use the --identifier <identifier> option.
Idle TTL: auto-unload with —ttl
You can load a model with an idle Time-To-Live, after which LM Studio unloads it for you. This frees memory when a model sits unused:
1 $ lms load google/gemma-4-12b-qat --ttl 3600 # Auto-unload after 1 hour of inactivity
lms unload
lms unload takes an optional <model_key>. If you don’t specify a model key then you will be shown a list of loaded models and you can interactively unload models:
1 $ lms unload
2
3 ! Use the arrow keys to navigate, type to filter, and press enter to select.
4 ! To unload all models, use the --all flag.
5
6 ? Select a model to unload | Type to filter...
7 qwen3-30b-a3b-instruct-2507-mlx
8 ❯ google/gemma-4-12b-qat
lms get
lms get supports searching for models on Huggingface by name and interactively downloading them. Here is an example:
1 $ lms get llama-3.2 --mlx --gguf --limit 6
2 Searching for models with the term llama-3.2
3 No exact match found. Please choose a model from the list below.
4
5 ! Use the arrow keys to navigate, and press enter to select.
6
7 ? Select a model to download (Use arrow keys)
8 ❯ [Staff Pick] Hermes 3 Llama 3.2 3B
9 [Staff Pick] Llama 3.2 1B Instruct 4bit
10 [Staff Pick] Llama 3.2 3B Instruct 4bit
11 [Staff Pick] Llama 3.2 1B
12 [Staff Pick] Llama 3.2 3B
13 DavidAU/Llama-3.2-8X3B-MOE-Dark-Champion-Instruct-uncensored-abliterated-18.4B-GGUF
lms chat
The CLI can start an interactive chat session right in your terminal. This loads a model and opens a prompt where you type messages and read replies, with no GUI needed:
1 $ lms chat
You can pass a model key to choose which model to load, for example lms chat google/gemma-4-12b-qat.
lms import
Use lms import to bring an external model file, for example a GGUF file you downloaded yourself, into LM Studio’s model library:
1 $ lms import <path-to-model-file>
Server Status and Control
1 $ lms server status
2 The server is running on port 1234.
3 Marks-Mac-mini:api_introduction $ lms server stop
4 Stopped the server on port 1234.
5 Marks-Mac-mini:api_introduction $ lms server start
6 Starting server...
7 Success! Server is now running on port 1234
8 Marks-Mac-mini:api_introduction $ lms ps
9
10 LOADED MODELS
11
12 Identifier: google/gemma-4-12b-qat
13 • Type: LLM
14 • Path: google/gemma-4-12b-qat
15 • Size: 8.07 GB
16 • Architecture: gemma4
lms runtime
LM Studio runs models on an inference runtime, either llama.cpp or Apple’s MLX. The lms runtime command manages these runtimes and their versions from the terminal. It replaces the manual runtime management you used to do in the app UI (Cmd+Shift+R on macOS):
1 $ lms runtime
lms log stream
lms log stream prints incoming and outgoing messages to your terminal. It is a great help when you debug tool use and API requests, because you see the exact prompts and responses that pass through the server:
1 $ lms log stream
This command is especially useful when you work through the tool use and MCP chapters later in the book.
Headless Mode: lms daemon
You can run LM Studio with no GUI as a headless daemon named llmster. This suits servers, CI pipelines, and any environment where a desktop app cannot run. The lms daemon commands manage the daemon:
1 $ lms daemon up # Start the headless daemon
2 $ lms daemon down # Stop the daemon
3 $ lms daemon status # Check daemon status
4 $ lms daemon update # Update the daemon
Every API example in this book works the same against a headless daemon. The chapter Headless Deployment with llmster covers this setup in depth.
LM Link: lms link
LM Link gives you end-to-end encrypted access to your local models from other devices, built in partnership with Tailscale. You can run a large model on a powerful desktop and reach it from a laptop or phone. The lms link commands control the feature:
1 $ lms link enable # Enable LM Link
2 $ lms link disable # Disable LM Link
3 $ lms link status # Check link status
4 $ lms link set-device-name # Set this device's name
5 $ lms link set-preferred-device # Set the preferred remote device
Developing and Publishing
If you want to share MCP servers or model configurations, LM Studio provides commands to authenticate with the LM Studio Hub and move artifacts to and from it:
1 $ lms login # Authenticate with LM Studio Hub
2 $ lms clone # Clone an artifact from LM Studio Hub
3 $ lms push # Upload an artifact to LM Studio Hub
4 $ lms dev # Start a plugin dev server (for MCP development)
lms dev starts a plugin development server in the current folder. It streamlines MCP server development by handling the server lifecycle and reloading your code as you edit. We return to lms dev in the MCP chapter.