GitHub - matheusml/zsh-ai: Transform natural language into shell commands instantly

GitHub

2 min read Original article ↗

zsh-ai: a green gecko curled around a retro terminal

Type # and describe a command. Press Enter to get it at your prompt.

$ # find files larger than 100mb changed this week
$ find . -type f -size +100M -mtime -7

Read it, edit it if needed, then press Enter again to run it.

Demo: typing # list all files and waiting for zsh-ai to suggest ls -la

You can also ask directly:

zsh-ai "show what is using port 3000"

Your request includes the directory path, nearby filenames, project type, git branch/status, and OS. Choose a hosted provider, or run a local model with Ollama or Apfel. Apfel uses Apple's on-device model on supported Macs.

Install

Needs zsh 5.0+, curl, and perl. jq is optional.

brew install matheusml/zsh-ai/zsh-ai

Add this to ~/.zshrc (keep your key out of public dotfiles):

export ANTHROPIC_API_KEY="your-key-here"
source "$(brew --prefix)/share/zsh-ai/zsh-ai.plugin.zsh"

Run source ~/.zshrc, then try # show current date.

See the install guide for Oh My Zsh, Antigen, manual installs, other providers, and local models.

Free local Apfel on supported Macs

On Apple Silicon with macOS 26+, Apple Intelligence, and the on-device model available, Apfel generates commands locally without an API key or hosted provider. See the Apfel setup.

Make it yours

Add command preferences before the plugin loads in ~/.zshrc:

export ZSH_AI_PROMPT_EXTEND="Prefer rg over grep and fd over find."

You can also change the comment trigger or turn it off.

Troubleshooting · Contributing · MIT license