WayToClawEarn
Beginner30 min readMay 11, 2026

How to run local AI models on M4 Mac with LM Studio: A complete 30-minute tutorial

Starting from scratch, install LM Studio and run Qwen local model on M4 MacBook

WayToClawEarn EditorialPublished May 11, 2026Updated Aug 8, 2026

Editorial review of public sources · AI-assisted drafting. How we work

<

Tutorial Objectives

In 30 minutes, use LM Studio to run through the local AI model on M4 Mac to achieve daily programming assistance and basic task processing without relying on cloud APIs. This article is a complete step-by-step tutorial.

What you will get

  • Local inference environment: Run through Qwen 3.5-9B model on M4 MacBook, reaching a practical speed of about 40 tokens/second
  • Complete Toolchain: LM Studio + Local Models + Utilities (Pi/OpenCode)
  • Cost Conscious: One-time hardware investment (if you already have a Mac), no subsequent API fees, and data is completely local

Preparation list

  • M4 Mac (24GB memory is the best configuration, 16GB can also run small models)
  • macOS 14+ (Sonoma or Sequoia)
  • Approximately 8GB free disk space
  • LM Studio (free, download from the official website)
  • Optional: Pi or OpenCode (command line AI tool)

Overall architecture

The local AI workflow is broken down into 3 steps, which can be operated in sequence.

ModuleInputOutputEstimated time
Installing LM Studio and modelsM4 Mac + NetworkRunning local model15 minutes
Configure inference parametersLoaded modelOptimized inference settings10 minutes
Access to command line toolsLocal API + Pi/OpenCodeComplete development environment5 minutes

LM Studio interface setup

Step 1: Install LM Studio and download the model

Download the macOS version from LM Studio and install it (native on Apple Silicon). After the installation is complete, search for the Qwen 3.5-9B model in the search bar and select the q4_k_s quantized version.

Why choose Qwen 3.5-9B? After multiple actual tests (including the HN community), this is currently the best choice with the best overall performance on M4 24GB memory:

  • About 40 tokens/second, completely smooth for daily use
  • Supports 128K context windows, enough to handle large code bases
  • Good tool calling ability and can be used with command line tools
  • Supports thinking mode, suitable for complex reasoning tasks
terminal

# ()

# : Qwen3.5-9B @ q4_k_s

# : ~5.6GB

# : 128K tokens

# : ~40 tok/s (M4 24GB)

# HuggingFace: Qwen/Qwen3.5-9B-GGUF

**** 16GB, Qwen 3-4B Gemma 4B,。 32GB , Qwen 3.6 Q3 Devstral Small 24B。

2

LM Studio ,。

temperature0.6, 0.8
top_p0.95
top_k20
min_p0.0
presence_penalty0.0
repetition_penalty1.0

(Thinking Mode)

。 LM Studio , Configuration → Inference , Prompt Template ,

{%- set enable_thinking = true %}

,。Qwen 3.5-9B 。

Qwen 3.5 thinking mode configuration

3

。 LM Studio

OpenCode — AI ,。 LM Studio API ( http://localhost:1234/v1),。

Pi — A more feature-rich AI terminal tool that supports multi-model switching and customized workflows. LM Studio will locally start an API service compatible with the OpenAI format, and Pi can be used directly after configuration.

It is recommended to use OpenCode for development and use Claude Code or ChatGPT to handle complex reasoning - this hybrid method can not only protect code privacy, but also obtain the reasoning capabilities of top models when needed.

It is recommended to use Claude Code in OpenCode to handle complex reconstruction tasks that cannot be handled by the local model, which is both cost-effective and efficient.

Frequently Asked Questions (FAQ)

Q1: What should I do if the system becomes stuck after loading the model?

Close unnecessary browser tabs and apps. Lower the Context Length setting in LM Studio to 32K or 64K to reduce memory usage. If it still gets stuck, switch to a smaller model (such as Qwen 3-4B).

Q2: The speed is less than 10 tokens/second?

Check if you are using a non-native Apple Silicon version. In the LM Studio settings make sure Metal (GPU accelerated) is selected instead of CPU Only. Q4_K_S quantization is a balance between speed and quality, and the GGUF format is more memory-saving than the EXL2 format.

Q3: The model output quality is too poor?

Confirm thinking mode is enabled. Check if temperature is too high (0.6 is recommended for coding tasks), try lowering top_p to 0.85. If you are still not satisfied, switch to a larger quantized version or close the 128K context window and run a shorter context.

Tool entry

The platform side will automatically match the tool names used naturally in the text and generate a hover-card based on the maintained tool library:

LM Studio, OpenAI, ChatGPT, Claude, Claude Code, Qwen, Pi, OpenCode, HuggingFace

Reference material

Internal link guidance

Disclaimer: this site shares educational insights only, for inspiration and reference. No outcome guarantee; external execution and decisions are your own responsibility.

Related tutorials