How to Run Local AI Coding on Mac for Free (OpenCode + LM Studio + Qwen)

18 October 2026 · 4:18 · 283 views · by Vikramjit Sarkar

Watch on YouTubeSubscribe for the next test

How to run local AI coding on Mac for free. Full setup tutorial: run a free local LLM coding agent on your Mac with LM Studio + OpenCode and Qwen 3.8 27B. No internet, no subscription, no API key. Step by step, plus the 5 real errors I hit and exactly how I fixed them.

Chapters

  1. 0:00Intro
  2. 0:24What you need (which model fits your RAM)
  3. 0:39Steps 1-2: Download LM Studio + a model
  4. 1:03Step 3: Start the LM Studio server
  5. 1:22Steps 4-5: Install OpenCode + the opencode.json config file
  6. 2:06Step 6: Your first task (the small-steps trick)
  7. 2:435 real problems and fixes
  8. 3:53Recap + wrap-up

0:00 Intro

This snake game was written by an AI running completely on my MacBook. No internet, no subscription, no API key. In the next few minutes, you'll set up the exact same thing, step by step. And I'll show you every mistake I made, so you don't make them. Quick thing first. This is part one of a full series on running AI coding tools on your own laptop. If that helps you, subscribe, so you get part two.

0:24 What you need (which model fits your RAM)

You need an Apple Silicon Mac. The rule is simple. The model file should be about half your RAM, or less. On my thirty two gig Mac, I use Qwen three point eight, twenty seven B. It's about sixteen gigs.

0:39 Steps 1-2: Download LM Studio + a model

Step one. Go to L M studio dot A I, download the app, and install it like any other Mac app. Step two. Click the search icon, and search for your model. Click show all options. See these red labels? Likely too large. That means it won't fit on your Mac. Pick one without the label, and click download. When it's done, it shows up in My Models.

1:03 Step 3: Start the LM Studio server

Step three. Open the Developer tab, and switch the status to running. This address is important. One two seven, dot zero, dot zero, dot one. Port one two three four. Load your model. In the load settings, set the context length. I use thirty two thousand, seven hundred sixty eight.

1:22 Steps 4-5: Install OpenCode + the opencode.json config file

Step four. Go to the OpenCode website, open the download page, and get OpenCode Desktop for Apple Silicon. Step five. This is where most people get stuck. OpenCode reads a settings file called OpenCode dot json, in a hidden folder. Open Terminal, and paste these three lines. They create the folder and the file, and open it in TextEdit. Now paste the settings from the description. The base URL is the LM Studio address, with slash v one at the end. The model name must match LM Studio exactly.

Timeout false gives a slow first answer time to arrive. And the limits must match your context length. Save the file.

2:06 Step 6: Your first task (the small-steps trick)

Step six. Open OpenCode, add your project folder, and start a new session. Check the model at the bottom. Qwen three point eight, twenty seven B. That's your local model. Now ask it to build something. And here's the trick that took me three failed tries. Ask it to work in small steps. It wrote the page first, then the game logic, then the restart button. One hundred and fifty three lines of code.

And here it is, running in the browser. Written by a model on my laptop.

2:43 5 real problems and fixes

Now, the real problems I hit while making this video. You'll probably hit them too. Problem one. Cannot connect to the API, connection refused. LM Studio's server is off. Switch it to running, and OpenCode reconnects by itself. Problem two. Write failed, and no file appears. My answer limit was only eight thousand tokens, too small for a whole file. Set output to sixteen thousand. Problem three. It fails after exactly five minutes. While the model writes a big file, LM Studio sends nothing, and after five silent minutes, OpenCode gives up.

The fix is to ask for small steps, or use a faster model. Problem four. Model not found. The name in your file must match LM Studio exactly. Copy it, don't type it. Problem five. It looks stuck on thinking. On my Mac, this model writes about five tokens a second. It's working. Check the Developer logs to be sure.

3:53 Recap + wrap-up

That's it. A free AI coding agent, running on your own Mac. In part two, I test oMLX, a faster way to run models on Apple Silicon. Subscribe, so it shows up for you. And if this worked for you, hit like, and share it with a friend who's stuck. Got a question, or an error I didn't cover? Ask me in the comments. I'll answer.

Related tests