Skip to content

LearnTutorials

Run local AI models on your Mac with LM Studio

Run Qwen3.5 9B on an Apple silicon Mac with LM Studio and MLX in 25 minutes, then connect OpenCode or Pi for free, private coding help.

By Recaply EditorsIntermediate25 min6 stepsUpdated

A hand lifts a wrench out of an open toolbox that sits on an open laptop's keyboard

What you need

LM Studio doesn't run on Intel Macs. MLX models need Apple silicon, so on Windows and Linux LM Studio uses GGUF models instead.

  1. Step 1: Install LM Studio

    3 min

    LM Studio downloads, runs and serves local models, and on a Mac it can use Apple's MLX framework.

    1. Go to lmstudio.ai/download and download the Mac version.
    2. Open the downloaded file, drag LM Studio into Applications, then open it.
    3. Open a terminal and run lms --help to check the command line tool.

    You should see the LM Studio window, and a list of lms commands in the terminal.

    The terminal can't find lms?

    The tool ships with the app but needs one launch first. Open LM Studio once, then open a new terminal window and try again.

    The lmstudio.ai home page now leads with Bionic, a separate agent app. This guide uses the LM Studio app.

  2. Step 2: Download Qwen3.5 9B as MLX

    6 min

    MLX builds are made for Apple silicon, and LM Studio lists 7 GB of memory as the minimum for this model.

    1. Press ⌘ + 2 to open the Discover tab, then search for qwen3.5 9b.
    2. Pick the MLX build at 4-bit and start the download.
    3. Or skip the app and run the command below in a terminal.
    Or run this
    lms get qwen/qwen3.5-9b --mlx

    You should see Qwen3.5 9B listed in the My Models tab once the download ends.

    Not sure which download option to pick?

    Choose the MLX build at 4-bit. LM Studio advises 4-bit or higher. The 8-bit build is a little sharper but needs about twice the memory.

  3. Step 3: Load it with a long context

    4 min

    Coding agents send long prompts, and Qwen advises at least 128K tokens of context to keep the model's thinking intact.

    1. Run lms ls and copy the model key, such as qwen/qwen3.5-9b.
    2. Load it with the command below. On a 16 GB Mac, use 32768 instead of 131072.
    3. In the Chat tab, ask a short question to test it.
    Run this
    lms load qwen/qwen3.5-9b --context-length 131072

    You should see a reply in the Chat tab, often after a short thinking section.

    Loading fails, or your Mac slows to a crawl?

    The context is too big for your memory. Unload the model in the app, close heavy apps, then load it again with --context-length 32768.

    Qwen3.5 thinks before it answers by default. The model's Enable Thinking setting turns that off for quick replies.

  4. Step 4: Set the model up for coding

    3 min

    Qwen suggests lower randomness for precise coding than LM Studio's defaults for this model.

    1. Open the My Models tab and click the gear icon next to Qwen3.5 9B.
    2. Set Temperature to 0.6 and Presence Penalty to 0.
    3. Leave Top P at 0.95 and Top K at 20, then save.

    You should see the new values in the model's default settings, used every time it loads.

    Replies start to repeat the same lines?

    Raise Presence Penalty a little. Qwen says values between 0 and 2 reduce endless repeats.

    These are Qwen's numbers for coding with thinking on, from its model card. An app that sends its own temperature overrides them.

  5. Step 5: Start the local server

    3 min

    The server gives the model an OpenAI-compatible address that coding tools can call.

    1. Open the Developer tab and turn on Start server. Or run lms server start in a terminal.
    2. Run the command below to check that the server answers.
    Run this
    curl http://localhost:1234/v1/models

    You should see a JSON list that includes qwen/qwen3.5-9b.

    curl says the connection was refused?

    The server isn't running yet. Check the Start server switch, or run lms server start, then try again.

    The server uses port 1234 and needs no API key by default. It stays on this Mac unless you choose to serve on your local network.

  6. Step 6: Connect OpenCode or Pi

    6 min

    With a local model behind them, both agents help you code for free, and your code never leaves your Mac.

    1. OpenCode: install it from opencode.ai/docs, then run opencode in your project folder.
    2. Type /models and pick Qwen3.5 9B under LM Studio. OpenCode finds LM Studio at http://127.0.0.1:1234/v1 on its own.
    3. Pi: add the config below to ~/.pi/agent/models.json, run pi, then type /model and pick the model.
    Pi: your models.json
    {
      "providers": {
        "lmstudio": {
          "baseUrl": "http://localhost:1234/v1",
          "api": "openai-completions",
          "apiKey": "lm-studio",
          "models": [
            { "id": "qwen/qwen3.5-9b", "reasoning": true }
          ]
        }
      }
    }

    You should see the agent answering in your project with Qwen3.5 9B as its model.

    Pi doesn't list the model in /model?

    Pi only lists models it has a key for. Keep the placeholder apiKey line, since LM Studio doesn't check keys unless you turn on authentication.

    Pi's models guide lists every field. Never put a real cloud API key in this file if you share it.

You get

Qwen3.5 9B running on your Mac through MLX, with a local server that OpenCode or Pi can use for coding help

Did this guide work for you?

Sources