Federico 推出 canfit,檢查本機大語言模型及應用程式能否啟動
I kept rebooting my machine to run local LLMs, so I built canfit
Federico 推出 canfit,可按當前可用記憶體檢查本機大語言模型及應用程式能否啟動,並在空間不足時建議可安全關閉的應用程式。它以 Rust 編寫,支援 macOS、Windows 和 Linux,不收集遙測資料,所有資料留在本機;系統程序不會被列為可關閉項目。GGUF 檢查會估算模型權重、上下文快取及額外開銷,Apple Silicon 上亦會檢查 GPU 可使用的統一記憶體限制。
The frustration
While building my previous open-source project, Knemora, I was running local LLMs on my Mac alongside Docker, a browser with too many tabs and everything else a developer keeps open. Memory kept running out.
Every time, the same question: what can I close safely, without killing something macOS needs?
The classic top shows you numbers, not answers.
It doesn't tell you whether the model you're about to load will fit, and it doesn't tell you which of those hundreds of processes are safe to close. More than once I just gave up and rebooted.
So I built the tool I wanted.
Meet canfit
canfit is the top command for people running local LLMs and apps.
It tells you if a model or an app can launch right now and, if it can't, what you can safely close to make room. System processes are never touched.
It's a single Rust binary for macOS, Windows and Linux, MIT licensed, with no telemetry: all data stays on your machine.
What it does
Can I launch it?
Point canfit at a GGUF model or an app and it checks it against the memory you have right now:
canfit model.gguf # can I launch this model?
canfit model.gguf --ctx 32768 # ...with a 32k context
canfit "Docker Desktop" model.gguf # both together?
For GGUF files it reads the header (parameters, quantization, layers, tensor sizes) and estimates weights + context cache + overhead. On Apple Silicon it also checks the GPU wired limit, because the GPU can only use part of unified memory.
What should I close?
If it doesn't fit, canfit suggests the smallest set of apps to close:
canfit free model.gguf
Every process is classified as safe, caution or never. System processes are never suggested, unknown processes default to caution, and nothing is closed without your confirmation.
A friendlier top
Run canfit with no arguments and you get a live monitor that starts with a sentence instead of a table ("Memory under pressure: Chrome is using 9 GB"), with processes grouped by app.
Watch
canfit watch -- llama-server -m model.gguf
Launch a command through canfit and it measures its real memory usage, so the next estimate is based on what actually happened.
Script-friendly
Every command supports --json, and the fit check returns an exit code (0 fits, 1 tight, 2 doesn't fit):
canfit model.gguf && llama-server -m model.gguf
Features overview
Install
canfit is available through Homebrew, Scoop, curl, PowerShell, .msi, .deb, .rpm and cargo install --git.
The exact commands for each platform are in the README:
👉 https://github.com/federicolaterra/canfit
Help me make the estimates better
This is 1.0.0, and memory estimates are the part I care about most.
And if you find it useful, a ⭐ on GitHub helps a lot.
Thanks for reading!
來源:DEV Community · dev.to


