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
<
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.
| Module | Input | Output | Estimated time |
|---|---|---|---|
| Installing LM Studio and models | M4 Mac + Network | Running local model | 15 minutes |
| Configure inference parameters | Loaded model | Optimized inference settings | 10 minutes |
| Access to command line tools | Local API + Pi/OpenCode | Complete development environment | 5 minutes |
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
# ()
# : 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 ,。
| temperature | 0.6 | , 0.8 |
| top_p | 0.95 | |
| top_k | 20 | |
| min_p | 0.0 | |
| presence_penalty | 0.0 | |
| repetition_penalty | 1.0 |
(Thinking Mode)
。 LM Studio , Configuration → Inference , Prompt Template ,
{%- set enable_thinking = true %}
,。Qwen 3.5-9B 。
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
- Someone has successfully practiced it: Claude Code 48 hours to start a business: one person + US$29 monthly fee, monthly income in 3 months $9,000
- Recommended tool: LM Studio
Related tutorials
How to Write .cursorrules: Cursor Prompt Engineering Guide (2026)
If Cursor's AI keeps generating code you have to fix every time, the problem is not the model: it is your rules file. A good .cursorrules can cut your edit-to-accept ratio from 3:1 to near 1:1. After eight months of iterating on Cursor rules across React, Python, and Go projects, this guide walks through what works, what breaks, and the templates I actually use.
Claude Code Pricing Guide: Plans, Credits, and Cost Optimization (2026)
I spend $80-150/month on Claude Code and use it 6-7 days a week. This guide breaks down exactly how Claude Code pricing works: per-token API billing, Anthropic credits, Max mode costs, the June 2026 billing change, and real monthly budgets from three developer profiles. I also share the six cost optimization techniques that cut my bill from $340 to $80 without reducing how much I ship.
Monetization angle
How can you make money from this trend?
WayToClawEarn focuses on verified earn playbooks—not just news. Start from these cases.
n8n + OpenAI affiliate site
Automate content and affiliate monetization
Claude + n8n automation agency
Charge monthly for agent workflow builds