Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

llamawizard

██╗     ██╗      █████╗ ███╗   ███╗ █████╗ ██╗    ██╗██╗███████╗ █████╗ ██████╗ ██████╗ 
██║     ██║     ██╔══██╗████╗ ████║██╔══██╗██║    ██║██║╚══███╔╝██╔══██╗██╔══██╗██╔══██╗
██║     ██║     ███████║██╔████╔██║███████║██║ █╗ ██║██║  ███╔╝ ███████║██████╔╝██║  ██║
██║     ██║     ██╔══██║██║╚██╔╝██║██╔══██║██║███╗██║██║ ███╔╝  ██╔══██║██╔══██╗██║  ██║
███████╗███████╗██║  ██║██║ ╚═╝ ██║██║  ██║╚███╔███╔╝██║███████╗██║  ██║██║  ██║██████╔╝
╚══════╝╚══════╝╚═╝  ╚═╝╚═╝     ╚═╝╚═╝  ╚═╝ ╚══╝╚══╝ ╚═╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ 

A terminal wizard that takes a Mac from zero to a running, hardware-appropriate local LLM stack. It detects your hardware, picks the right model via whichllm, downloads it, builds llama.cpp (Metal-accelerated on Apple Silicon), installs and configures llama-swap, sets up a LaunchAgent for auto-start on boot, and runs a health check before it says "done."

After setup, it doubles as an ongoing management tool: start, stop, restart, status, health checks, log viewing, and model management.

Run local LLMs on macOS with GGUF models, Apple Silicon acceleration, and an OpenAI-compatible API.

Keep your customizations: edit one llama-swap YAML file for aliases, context sizes, and model profiles. Adding a model preserves existing entries; config apply synchronizes shared settings to Pi with backups and a service-readiness check. See Customize local LLM profiles.

Status: actively developed. Commands and file layout may still change between versions.

Table of contents

Quick start

Already have Go, Homebrew, and Xcode Command Line Tools set up?

go install github.com/eduard-lt/llamawizard/cmd/llamawizard@latest
export PATH="$HOME/go/bin:$PATH"   # add to ~/.zshrc if not already there
llamawizard

That launches the setup wizard. If you're on a clean Mac with none of the prerequisites installed, see Setting up dependencies on a fresh Mac first.

Requirements

  • macOS (Apple Silicon or Intel)
  • Go 1.26+ (to build from source)

On Apple Silicon, llamawizard builds llama.cpp from source with Metal acceleration. On Intel Macs, it falls back to the Homebrew formula (no Metal build) — expect slower inference.

The wizard also needs these tools and will install them for you when possible:

Dependency Purpose Auto-installed?
Xcode Command Line Tools git, make, C/C++ compiler No — requires GUI popup
Homebrew macOS package manager No — must install manually
cmake Build llama.cpp Yes (via brew install cmake)
git Source checkout Yes (via brew install git)
uv Run whichllm for model ranking Yes (via brew install uv)
pi A minimal agent harness - optional. Yes (via npm install -g @earendil-works/pi-coding-agent; requires npm)

Setting up dependencies on a fresh Mac

If you're starting from a clean macOS install, run these in order.

1. Install Xcode Command Line Tools

xcode-select --install

A GUI dialog will appear. Click "Install", agree to the license, and wait for it to finish. Then verify:

xcode-select -p

2. Install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Follow the prompts. After it finishes, Homebrew will print instructions to add it to your PATH. Follow those — typically:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Verify it's working:

brew --version

3. Install Go (if building from source)

brew install go

Or download the installer from go.dev.

4. Add Go tools to your PATH — see Install below.

Once these are done, llamawizard can handle the rest — it will automatically install cmake, git, and uv if they're missing.

Faster downloads (optional)

Set a HuggingFace token to get authenticated download speeds:

export HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxx

Or use the equivalent HUGGINGFACE_HUB_TOKEN. Without a token, HuggingFace throttles anonymous downloads. Create a token here.

Install

go install (requires Go 1.26+)

go install github.com/eduard-lt/llamawizard/cmd/llamawizard@latest

Puts llamawizard in $GOPATH/bin. If you haven't already, add it to your PATH:

bash — add this to ~/.bashrc or ~/.bash_profile:

export PATH="$HOME/go/bin:$PATH"

zsh (macOS default) — add this to ~/.zshrc:

export PATH="$HOME/go/bin:$PATH"

Then reload your shell config (source ~/.zshrc or source ~/.bashrc) or open a new terminal.

Verify it's installed correctly:

llamawizard --version

Manual build

git clone https://github.com/eduard-lt/llamawizard.git
cd llamawizard
go build -o llamawizard ./cmd/llamawizard/
./llamawizard

Homebrew tap (coming soon)

A Homebrew tap is planned but not yet available. For now, use go install or manual build above.

What the wizard does

Running llamawizard with no arguments walks through every step:

  1. Dependency check (Homebrew, Xcode CLT, cmake, git, uv)
  2. Hardware detection (chip, RAM, Metal)
  3. Model selection via whichllm's ranked recommendations
  4. Download with progress and resume support
  5. llama.cpp source build (Metal on Apple Silicon) or Homebrew formula
  6. llama-swap install and configuration
  7. Port selection with conflict detection
  8. API key setup (default: dummy)
  9. LaunchAgent install for auto-start on boot
  10. Health check against /v1/models

Commands

Command Description
llamawizard Launch the setup wizard
llamawizard status, st Show service status and health
llamawizard start Start the llama-swap service
llamawizard stop Stop the llama-swap service
llamawizard restart, re Restart the llama-swap service
llamawizard warlock, wl Live service guardian: rain dashboard (logs, events, RAM) with automatic restart; opens LAN access while open
llamawizard doctor, dr Run a standalone health check
llamawizard logs, lg Show recent service logs (-f follow, -n <N> lines)
llamawizard models list, m ls List configured models
llamawizard models add, m a Add a model (interactive)
llamawizard models add --link <url> [--name <name>] Add a model from a direct download URL
llamawizard models show, m sh <name> Show a model's config and file path
llamawizard models remove, m rm <name> Remove a model from config only — file stays on disk
llamawizard models delete <name> [--yes] Remove a model from config and delete its file (no shorthand)
llamawizard config apply [--dry-run] [--default ID] Apply master model settings to Pi, preserve customizations, and verify service readiness
llamawizard config show, cfg sh Print the active config
llamawizard config path, cfg p Print config file location
llamawizard pi install Install and configure pi coding agent
llamawizard pi uninstall Uninstall pi coding agent
llamawizard completion <bash|zsh|fish> Print shell completion script (setup in Shell completion)
llamawizard update, up Check for and install updates
llamawizard uninstall Stop service and remove LaunchAgent (no shorthand)
llamawizard version, v Show versions of llamawizard, llama.cpp, and llama-swap
llamawizard help, h [command] Show a command reference

Notes on commands whose behavior isn't obvious from the name alone:

  • warlock polls launchctl print every 2 s and issues a kickstart/bootstrap restart within ~2 s of detecting death (retry every 5 s until the service is back); the dashboard shows the last 5 log lines, guardian events, RAM metrics, and the machine's LAN IP; keys: q quit, r toggle auto-restart, a restart now.
  • LAN access is tied to the warlock session: while it is open the proxy listens on 0.0.0.0:<port> (shown as LAN on the service line), so other devices on the network can connect to http://<laptop-ip>:<port>/v1 (send the API key as Authorization: Bearer <key> if one is set); when warlock exits — quit, crash, or any termination signal — the plist is restored to its original listen host and reloaded. Run warlock --no-lan to keep the loopback-only binding. The first remote connection triggers the macOS firewall prompt for the llama-swap binary; click Allow. The plist reload briefly restarts the service when warlock starts and when it exits — unless the service was stopped while warlock was open (e.g. llamawizard stop in another terminal): then warlock restores the plist on exit but does not restart the service.
  • stop unloads the service from launchd via bootout, not a plain kill. The LaunchAgent plist uses KeepAlive with SuccessfulExit=false, so a raw kill would just get the process restarted — bootout is the correct way to actually stop it.
  • doctor polls http://127.0.0.1:<port>/v1/models with exponential backoff (first attempt immediate, then 2s, 4s, 8s, 16s) and confirms every expected model ID is present. On failure it prints the last 20 lines of the llama-swap error log, and saves the result to state.json.
  • models remove deletes the entry from state.json, regenerates the llama-swap config, and restarts the service — but leaves the model file untouched on disk. Use models delete if you also want the file gone.
  • uninstall is interactive and asks for confirmation before stopping the service, removing the LaunchAgent plist, and deleting state.json. Model files and the config directory are left in place for manual cleanup.
  • logs prints the last 30 lines of both llama-swap.log and llama-swap-error.log; add -f for live following.

Shell completion

Append the completion script for your shell to your shell's rc file. It covers all commands, aliases, subcommands, and flags.

bash — append to ~/.bashrc, then run source ~/.bashrc:

llamawizard completion bash >> ~/.bashrc

zsh (macOS default) — append to ~/.zshrc, then run exec zsh:

llamawizard completion zsh >> ~/.zshrc

fish — append to ~/.config/fish/config.fish:

llamawizard completion fish >> ~/.config/fish/config.fish

Model customization

Keep aliases, different context sizes, and multiple profiles sharing the same GGUF in ~/.local/ai/config/llama-swap.yaml:

$EDITOR ~/.local/ai/config/llama-swap.yaml
llamawizard config apply --dry-run
llamawizard config apply

Adding a model merges in its new entry. Existing profiles and Pi-specific settings are preserved. Read the customization and recovery guide for examples and the exact synchronization rules.

Testing

Run go test ./... -race -count=1 and go vet ./.... See testing and manual acceptance for isolated CLI end-to-end coverage and optional real launchd checks.

Architecture

cmd/llamawizard/main.go
        |
        v
internal/wizard/            Bubble Tea TUI, multiple screens
        |
   -----+---------+------------+------------+--------+--------+
   v    v         v            v            v        v        v
hardware  whichllm  download   build       llamaswap launchd  state
(chip,   (exec     (HF file   (llama.cpp   (config   (plist   (state.json
 RAM,     wrapper   resolve    brew/source  templating bootstrap read/write)
 Metal)   + JSON    + resume   build)       + write)  /enable/
          parsing)  + verify)                        kickstart/
                                                       kill/
                                                       print)
                                                         |
                                                         v
                                                   health/
                                                   (post-install +
                                                    doctor checks)

Packages

Package Purpose
internal/hardware Chip type, RAM, Metal detection via sysctl
internal/whichllm Exec wrapper around uvx whichllm for model ranking
internal/download HuggingFace file resolution and resumable download
internal/build Dependency detection, brew install, llama.cpp three-tier build
internal/llamaswap llama-swap install, YAML config generation, safe write with diff
internal/launchd Plist generation, modern launchctl wrappers (bootstrap/bootout/enable/kickstart/print)
internal/health Doctor check: polls /v1/models with exponential backoff
internal/state state.json read/write, model entry definitions
internal/network Port probing via bind+close, alternative port suggestions
internal/wizard Bubble Tea TUI orchestrating all packages

Files on disk

Path Purpose
~/.local/ai/state.json Download inventory and service settings: port, chip, binary paths, installed files
~/.local/ai/config/llama-swap.yaml Editable master model configuration, profiles, aliases, and API keys
~/Library/LaunchAgents/com.local.llama-swap.plist LaunchAgent for auto-start
~/.local/ai/logs/llama-swap.log llama-swap stdout log
~/.local/ai/logs/llama-swap-error.log llama-swap stderr log
~/models/<slug>/ Downloaded model files
~/.local/ai/llama.cpp/ Source build tree (reused if present)

Troubleshooting

Config YAML looks corrupted after hand-editing (bad indentation, missing fields) Use spaces for YAML indentation. Run llamawizard config apply --dry-run to validate edits before applying. Existing customizations are preserved when adding models. See the backup recovery instructions.

doctor reports a model missing after a config change Run llamawizard config apply after editing the master YAML to synchronize Pi and verify the service API. Readiness checks confirm the API listing; test an inference request to verify a model loads within available memory.

License

MIT — see LICENSE.


If llamawizard is useful to you, consider starring the repository.

Buy Me A Coffee

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages