How to Get Autocorrect in Terminal on Mac

macOS autocorrect does not work in Terminal, and neither does Charm. The command-line prompt uses a fundamentally different input model than standard text fields - it bypasses the text processing pipeline that both macOS autocorrect and accessibility-based tools rely on. The best autocorrect tools for Terminal are shell-native: zsh's built-in CORRECT option, Tab completion, and for prose written around your terminal work, Charm does apply.

Why autocorrect doesn't work in Terminal on Mac

On macOS, the system autocorrect engine works by hooking into NSTextView and NSSpellChecker - the text-handling layer built into native Mac app frameworks. When you type in Mail, Notes, Messages, or any other standard Mac app, your input flows through these APIs, and the spell checker can intercept and correct it.

Terminal's command prompt does not work this way. The shell prompt is handled entirely by the shell process running inside Terminal - zsh, by default on modern Macs. Your keystrokes go directly to the shell's line editor (zle, the zsh line editor), not through NSTextView or NSSpellChecker. macOS autocorrect has no visibility into what you type at the command line, regardless of what you have enabled in System Settings.

Charm's Accessibility API approach has the same limitation here. Charm monitors and corrects text in standard text fields by observing accessibility events that apps broadcast when their text content changes. Terminal's command prompt input does not surface through these events in a way that allows text substitution. Charm can read some Terminal content, but it cannot modify the command line as you type.

The short version: Neither macOS autocorrect nor Charm can fix typos in Terminal commands as you type them. This is a fundamental input model difference, not a configuration issue. The right tools for Terminal typos are the ones built into your shell.

zsh spell correction: the built-in Terminal fix

zsh - the default shell on macOS Ventura and later - includes a built-in spell correction feature called CORRECT. When enabled, it detects mistyped command names and asks if you meant something else before running anything.

If you type gti status and press Enter, zsh responds with:

zsh: correct 'gti' to 'git' [nyae]?

Press y to accept the correction and run git status, or n to run your original input as typed. It does not silently overwrite your commands - it always asks first, which is the right behaviour at a command line where a wrong substitution could cause real damage.

Developers make an average of 3-5 command typos per hour. zsh CORRECT catches mistyped command names reliably, though it does not correct flag names or arguments - for those, Tab completion is more useful.

How to enable zsh CORRECT

  • Open Terminal and run nano ~/.zshrc to open your zsh config file
  • Add this line anywhere in the file: setopt CORRECT
  • Save and exit: press Ctrl+O, then Enter, then Ctrl+X
  • Apply the change immediately by running source ~/.zshrc

From this point on, any time you mistype a command name, zsh will offer a correction before executing. The setting persists across Terminal sessions because it is saved in your ~/.zshrc file.

There is also a stricter variant: setopt CORRECT_ALL checks not just the command name but all arguments too. This can be helpful but also produces more false positives - file paths and flags can look like typos to zsh. Start with CORRECT and switch to CORRECT_ALL if you want broader coverage.

Tab completion in Terminal: autocomplete for commands and files

Tab completion is the other essential autocorrect tool in Terminal - arguably more important than spell correction for day-to-day use. Press Tab mid-command and zsh completes the command name, file path, flag, or argument automatically.

It works on macOS out of the box with no configuration:

  • Type git che and press Tab - zsh completes to git checkout
  • Type cd Doc and press Tab - zsh completes to cd Documents/
  • Type git -- and press Tab twice - zsh lists all available flags for the git command

If there are multiple possible completions, pressing Tab twice shows all options. This doubles as a discovery tool: you can see which flags a command accepts without reaching for a man page.

zsh also supports history search. Press Ctrl+R to search backwards through your command history as you type - useful when you want to re-run a complex command you used earlier without remembering the exact syntax.

Where Charm helps Terminal users

Even though Charm cannot correct commands in Terminal's prompt, it is still useful in the writing work that surrounds terminal-based development.

The places where Charm does help developers who live in Terminal:

  • Code comments and documentation - Charm corrects spelling and grammar in VS Code, Sublime Text, and other editors where you write inline comments, docstrings, and README files
  • Commit messages in VS Code - when writing commit messages in VS Code's built-in source control panel, Charm is active and corrects your prose
  • GUI git clients - commit message fields in apps like Tower, Fork, and GitHub Desktop are standard text fields where Charm corrects normally
  • Markdown and documentation files - any prose file open in a text editor gets full Charm correction, whether it is a wiki page, API reference, or project README

This is not a consolation prize. Commit messages, documentation, and inline comments are the parts of developer output that other people read. A well-corrected README matters more than whether a shell command was mistyped and immediately re-run.

For a complete guide to Charm in a development environment, see How to Get Spelling Correction in VS Code on Mac.

Better alternatives: iTerm2 and Fish shell

If zsh's built-in tools are not enough, two alternatives offer a more powerful experience.

iTerm2

iTerm2 is a free Terminal replacement for Mac with a built-in autocomplete feature. Press Cmd+; to open a popup showing completions drawn from your command history - every command you have previously typed is searchable and insertable without retyping. It is not spell correction in the traditional sense, but it is the closest thing Terminal-side to getting a suggestion as you type.

iTerm2 also supports shell integration, paste history, and split panes. It is the most popular Terminal replacement among Mac developers and worth installing if you spend significant time in the command line.

Fish shell

Fish (Friendly Interactive SHell) is a drop-in replacement for zsh that offers real-time history-based suggestions as you type - no configuration required. As you type each character, Fish shows a greyed-out suggestion based on your command history. Press the right arrow key to accept it.

Fish suggestions are significantly more responsive and contextual than zsh CORRECT. The trade-off is compatibility: Fish uses a different scripting syntax than Bash and zsh, which means some scripts and dotfiles need adjustment.

Tool What it does Setup required
zsh Tab completion Completes commands, paths, and flags None - works out of the box
zsh CORRECT Suggests corrections for mistyped command names Add setopt CORRECT to ~/.zshrc
Ctrl+R history search Searches command history as you type None - built into zsh
iTerm2 autocomplete History-based popup completions via Cmd+; Install iTerm2 (free)
Fish shell Real-time inline history suggestions Install Fish, change default shell

For most users, adding setopt CORRECT to ~/.zshrc and using Tab completion consistently is a meaningful improvement with zero cost. Fish is worth considering if you want a more polished experience and are comfortable adjusting your shell setup.

Frequently asked questions

Does autocorrect work in Terminal on Mac?

No. macOS autocorrect does not work in Terminal's command prompt. The shell input area does not use NSTextView or NSSpellChecker - the pipeline that the macOS autocorrect engine depends on. Instead, use zsh's built-in CORRECT option for command name corrections and Tab completion for everything else.

How do I enable spell correction in Terminal?

Add setopt CORRECT to your ~/.zshrc file and run source ~/.zshrc to apply it. After that, zsh will suggest corrections for mistyped command names by prompting "Did you mean: ..." before executing. Press y to accept the correction or n to run the original command.

Does Charm work in Terminal on Mac?

Charm does not correct text in Terminal's command prompt. The shell prompt uses an input model that Charm's Accessibility API approach cannot modify. Charm does work in the text fields adjacent to terminal-based development: commit message fields in GUI git clients, code comments and documentation in VS Code, and any prose file open in a text editor.

What is the best autocomplete tool for Terminal on Mac?

For built-in options, zsh Tab completion combined with setopt CORRECT covers the most common cases with no extra setup. For a more powerful experience, Fish shell provides real-time history-based suggestions as you type. iTerm2's Cmd+; autocomplete is a good middle ground if you want to stay close to standard Terminal behaviour.

Charm works everywhere you write prose.

Spelling, grammar, and word prediction across every Mac app where prose is written. $9.99, yours forever.

Learn more about Charm Get Charm for Mac $9.99