Skip to content

[Bug] Unsloth Desktop on macOS M4: llama-server fails to start & excessive idle RAM usage #8566

Closed

Description

@ChenHongYu2026

Environment

  • Product: Unsloth Desktop (installed from GitHub release)
  • OS: macOS, Apple Silicon M4, 16GB unified memory
  • GPU: Apple Silicon (Metal/MPS)

Issue 1: llama-server fails to start when loading local GGUF models

Description

When attempting to load any local GGUF model, the following error occurs every time:

Failed to load model: llama-server failed to start. Check that the GGUF file is valid and you have enough memory.

This happens with all models, including small 1B-3B models that should easily fit in 16GB memory. No model can be loaded successfully.

Steps to Reproduce

  1. Open Unsloth Desktop on macOS M4
  2. Attempt to load any local GGUF model (tested 1B-3B models)
  3. Error appears: llama-server failed to start

Expected Behavior

The GGUF model should load successfully, especially for small 1B-3B models on a 16GB M4 Mac.

Actual Behavior

llama-server fails to start every time. The issue is 100% reproducible. This suggests the bundled llama-server binary may have compatibility issues on Apple Silicon M4 / macOS.


Issue 2: Excessive idle RAM usage immediately after startup

Description

Unsloth Desktop consumes abnormally high RAM immediately after launch, before any task is running:

Process RAM Usage
WebKit WebContent 649 MB
Python (Unsloth) 513 MB
Total ~1.16 GB

This is observed right after startup with no operations performed. For a desktop app that is idle, this memory footprint seems excessive and may cause issues on machines with limited RAM.

Expected Behavior

Idle RAM usage should be significantly lower, especially when no model is loaded and no task is running.

Actual Behavior

Over 1GB of RAM is consumed immediately on startup, before any user interaction.


Additional Notes

  • Both issues are 100% reproducible on macOS M4 with 16GB RAM.
  • The llama-server issue completely blocks model loading, making the app non-functional for its primary purpose.
  • The high idle memory usage suggests possible resource leaks or overly aggressive pre-loading.

Activity

  1. Lyxot commented on Aug 12, 2026

    @Lyxot
    Collaborator

    Issue 1

    If you configure a small Context Length before loading the model, can it work?

    Image Image

    If yes that's probably caused by our auto context settings, we will fix it

    Issue 2

    The issue is real but nothing is leaked here. We will optimize it

  2. danielhanchen commented on Aug 12, 2026

    @danielhanchen
    Member

    Thanks for the report. Two separate things here, so let me take them in turn.

    Issue 1: llama-server fails to start

    That exact message is the last-resort branch of our failure classifier: it is what you get when nothing in llama-server's output was recognised. It names the GGUF and memory because those are the common causes on other platforms, not because we detected either, and on a 16GB M4 loading a 1-3B model both are almost certainly fine. So the message is misleading you, and I cannot tell from it what actually went wrong.

    The file that can tell us is here:

    ls -t ~/.unsloth/studio/logs/llama-server/llama-*-port-*.log | head -1
    

    (or under $UNSLOTH_STUDIO_HOME/logs/llama-server/ if you set that). Studio writes every byte of llama-server's stdout and stderr there, one file per attempt. Could you paste the tail of the newest one, plus your macOS version (sw_vers -productVersion) and whether you installed through the Desktop app or install.sh?

    If you want to narrow it down yourself, the first line of that log usually settles it:

    • No build: banner at all - the process died before it ran. Loader, code signature, or architecture.
    • A build: banner then invalid argument / unknown argument - the wrong llama-server binary got picked up, most often a stale or custom one.
    • A Metal banner (ggml_metal_init:) then a crash - the Metal path.
    • Model metadata then a KV or compute buffer allocation failure - context sizing, and lowering the context length in the model settings should get you running.

    Separately, I have opened #8574, which fixes two things this report exposed regardless of what your log says:

    1. macOS never got a dyld search path. The code that builds llama-server's environment branched Windows vs everything-else, and the everything-else branch is Linux-specific, ending in LD_LIBRARY_PATH. dyld ignores that variable, so llama-server was launched on macOS with no library search path at all. Our installer's own validation step does set DYLD_LIBRARY_PATH, which is why this survived: install-time checks passed on a path the real launch never took. Confirmed and fixed on Apple Silicon CI, where the same check fails before the change and passes after. A healthy prebuilt resolves its libraries through @loader_path and does not depend on this, so I am not claiming it is your root cause, but it is a real hole.

    2. macOS startup failures were misclassified. dyld's wording shares nothing with glibc's, so a missing dylib, a rejected code signature, a wrong-architecture library and "built for macOS X which is newer than running OS" all collapsed into the message you saw. They are now named. macOS also kills a binary with an invalid signature using signal 9, which we were reporting as out of memory.

    3. That generic message now carries llama-server's own output and the path of the log, so the next person who hits this does not have to be asked for a file.

    Issue 2: idle RAM

    This one is working as designed rather than leaking, though I agree the number is high.

    Right after the server starts listening, Studio kicks off a background thread that imports torch, transformers, datasets and unsloth_zoo, and on Apple Silicon the MLX stack as well. It also warms the embedding model used for document search. That is deliberate: it front-loads roughly ten seconds of import time so your first chat or training request is not slow. The cost is the ~500MB of resident Python you measured, with no model loaded.

    You can turn all of it off:

    UNSLOTH_STUDIO_DISABLE_TORCH_WARM=1
    

    Nothing heavy is then imported until something actually needs it. The trade is that the first request pays the import cost instead.

    The ~650MB WebKit process is the web UI itself. It is at the high end for a WKWebView app and the frontend bundle is worth trimming, so I will take that as a fair point. One thing to note on measurement though: macOS Activity Monitor reports physical footprint, which counts memory shared with the GPU process, so adding the two process figures overstates the real total. If you are seeing it climb over time rather than sit at 1.16GB, that would be a different and more interesting bug, and worth its own issue with the growth numbers.

  3. danielhanchen commented on Aug 13, 2026

    @danielhanchen
    Member

    Thanks for the detailed report. #8574 just landed on main and it changes what happens on both halves of this, though not in the same way, so I want to be straight about which part is a fix and which part is an explanation.

    Part 1: llama-server fails to start

    Two things were wrong, and only one of them is certainly yours.

    The loader path. On macOS the child environment we hand llama-server never carried DYLD_LIBRARY_PATH. The code branched Windows vs everything-else, and the everything-else branch is Linux specific, ending in LD_LIBRARY_PATH, which dyld ignores. Our other engines already got this right, and the llama.cpp installer's own post-install validation sets DYLD_LIBRARY_PATH itself, so install-time validation was passing on a path the real launch never took. That is now fixed.

    Being honest about it: the pinned macOS prebuilt links its dylibs through @loader_path, so a healthy bundle resolves with no DYLD variable set at all. This was a real latent bug, and it is exactly the kind that bites when a bundle is not healthy, but I cannot claim it was proven to be your failure. I do not have your log.

    The message you saw. This is the part I am confident helped nothing. "Check that the GGUF file is valid and you have enough memory" is the last-resort fallback, and it threw away the two things that would have settled this: llama-server's own output and the path of the log file Studio had already written. macOS failures were also being misread. dyld says Library not loaded, Symbol not found, mach-o file, but is an incompatible architecture, or built for macOS X which is newer than the running OS, and none of that matched the glibc wording we were looking for. Worse, macOS SIGKILLs a binary whose code signature is invalid, and we had returncode == -9 hardcoded to "most likely out of memory", which is the precise wrong advice.

    Now the error carries the last of llama-server's output and the log path, and the macOS loader failures are named for what they are.

    What would settle your case. The log is here:

    ${UNSLOTH_STUDIO_HOME:-~/.unsloth/studio}/logs/llama-server/llama-<epoch>-port-<port>.log
    

    It is the full stdout and stderr of the process that died. Also useful: your macOS version, and whether you installed via the Desktop app or install.sh.

    You can read it yourself, roughly:

    • no build_info banner at all means the process died before main(), so it is the loader, the signature, or the architecture;
    • a banner then invalid argument means the wrong or a stale binary;
    • a Metal banner then a crash means the Metal path;
    • a KV or compute allocation failure means context budgeting, which on 16 GB is plausible.

    One limitation worth stating plainly: our macOS CI installs via install.sh and drives the API. It does not exercise the packaged Desktop app, which is the path you are on. So the fix is verified on Apple Silicon, but not through the app bundle you are running.

    Part 2: idle RAM

    This is the current design point rather than a leak, and #8574 does not change it.

    Right after the socket binds, Studio starts a background warm thread that imports torch, transformers and datasets, and on Apple Silicon also the MLX stack; the RAG embedder is warmed too. That is what the ~513 MB Python figure is. It buys first-request latency and costs resident memory.

    There is a supported way off it:

    UNSLOTH_STUDIO_DISABLE_TORCH_WARM=1
    

    That skips the warm entirely. The cost is that the first request pays the import.

    The ~649 MB WebKit figure is high-ish but is bundle driven: the frontend has almost no route-level code splitting. That is worth improving and is not a Tauri misconfiguration.

    On the leak question: a single Activity Monitor snapshot of two processes is not evidence of one, since phys-footprint double counts shared and IOSurface pages. If you think it is growing, the useful thing is the same two numbers sampled over an hour or two of ordinary use.

    Leaving this open until we know what your log says.

  4. ChenHongYu2026 commented on Aug 14, 2026

    @ChenHongYu2026
    Author

    Thanks for the follow-up and for #8574. The llama-server log on this machine points to a different failure than dyld, OOM, or context length.
    Environment

    • macOS 26.5.2 (25F84), Apple Silicon M4, 16 GB
    • Installed via the Desktop app (not install.sh)
    • Hugging Face cache is on an exFAT volume:
      /Users/luis/.cache/huggingface → /Volumes/LuisData/.cache/huggingface
      What actually fails
      llama-server starts. The process then loads a macOS AppleDouble sidecar instead of the real GGUF.
      On exFAT, macOS writes ._<filename>.gguf next to the model. Those files are a few KB of Finder metadata, not weights. Studio’s GGUF scan matches *.gguf, so both of these are candidates:
    • Muse-Glimmer-30B-UD-Q2_K_XL.gguf — the real model
    • ._Muse-Glimmer-30B-UD-Q2_K_XL.gguf — the sidecar
      Studio launches llama-server on the ._* file. llama-server exits with:
    gguf_init_from_reader: invalid magic characters: '????', expected 'GGUF'
    llama_server: exiting due to model loading error
    

    The UI then shows the fallback “GGUF invalid / not enough memory” message. That classifier is misleading here: the real models are in the cache, the directory is correct, and llama-server is runnable. The picker/scanner chose the sidecar.
    The same ._*.gguf path shows up for several models, including small ones (gemma-4-E2B, Hy-MT2-1.8B, NVIDIA-Nemotron-3-Nano-4B). In the same session, a real file without the ._ prefix loaded and ran:

    Qwen3-ASR-1.7B-Q8_0.gguf → model loaded, server listening, inference OK
    
  5. ChenHongYu2026 commented on Aug 14, 2026

    @ChenHongYu2026
    Author

    Reopened — closed by mistake. The llama-server GGUF picker issue is still unresolved.

  6. ChenHongYu2026 commented on Aug 14, 2026

    @ChenHongYu2026
    Author

    Thanks for the follow-up and for #8574. The llama-server log on this machine points to a different failure than dyld, OOM, or context length.

    Environment

    • macOS 26.5.2 (25F84), Apple Silicon M4, 16 GB
    • Installed via the Desktop app (not install.sh)
    • Hugging Face cache is on an exFAT volume:
      /Users/luis/.cache/huggingface → /Volumes/LuisData/.cache/huggingface

    What actually fails

    llama-server starts. The process then loads a macOS AppleDouble sidecar instead of the real GGUF.

    On exFAT, macOS writes ._<filename>.gguf next to the model. Those files are a few KB of Finder metadata, not weights. Studio’s GGUF scan matches *.gguf, so both of these are candidates:

    • Muse-Glimmer-30B-UD-Q2_K_XL.gguf — the real model
    • ._Muse-Glimmer-30B-UD-Q2_K_XL.gguf — the sidecar

    Studio launches llama-server on the ._* file. llama-server exits with:

    gguf_init_from_reader: invalid magic characters: '????', expected 'GGUF'
    llama_server: exiting due to model loading error
    

    The UI then shows the fallback “GGUF invalid / not enough memory” message. That classifier is misleading here: the real models are in the cache, the directory is correct, and llama-server is runnable. The picker/scanner chose the sidecar.

    The same ._*.gguf path shows up for several models, including small ones (gemma-4-E2B, Hy-MT2-1.8B, NVIDIA-Nemotron-3-Nano-4B). In the same session, a real file without the ._ prefix loaded and ran:

    Qwen3-ASR-1.7B-Q8_0.gguf → model loaded, server listening, inference OK
    
  7. Lyxot commented on Aug 14, 2026

    @Lyxot
    Collaborator

    You're right, and thanks for digging this out — that's the bug. Reproduced it here.

    Why it happens

    Your models sit on an exFAT drive. exFAT can't hold Mac file info, so macOS parks that info in a small extra file next to the model, named ._ plus the real name. It's about 4 KB. It is not a model.

    Studio picks up anything ending in .gguf and takes the first one by name. ._ sorts before letters, so it takes the fake one every time. llama-server opens 4 KB of Finder data, finds no GGUF header, and quits. What you saw after that was our catch-all message, which is why it blamed the file and
    your RAM.

    That's also why only some models break. Models downloaded inside the app get no ._ twin. Models you download in a browser, or drag over in Finder, do. Your Qwen3-ASR file was clean, so it ran.

    Same bug hits vision models (we pick ._mmproj-...) and split models (we pick every ._ part).

    Workaround for now

    One command, then load the model again:

    dot_clean -m /Volumes/LuisData/.cache/huggingface

    That clears the ._ files. Tested here: 5 before, 0 after. Run it again after you add models by browser or Finder, since macOS makes new ones.

    If you want them gone for good, format that drive as APFS. exFAT also forces the cache to keep full copies instead of links, so it's costing you disk space too.

    The fix

    We'll skip ._ files everywhere Studio looks for GGUFs, and check a file really starts with GGUF before we hand it to llama-server. We'll also give "invalid magic characters" its own message, so this never shows up as a memory problem again.

    Keeping this open until that ships.

  8. added 6 commits that reference this issue on Aug 15, 2026
    b398867
    e51f3a1
    59ae87b
    d586aea
    8f09175
    c7ec308
  9. added a commit that references this issue on Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions