2 min read

The Z Shell (Zsh) on macOS Tahoe

As of macOS Tahoe, the default shell for the terminal is Zsh (Z shell). It replaces Bash, offering a more modern, feature-rich command-line experience out of the box.

Why Zsh?

Zsh is highly compatible with Bash but includes improvements that make interactive use much friendlier.

1. Intelligent Tab Completion

Zsh's tab completion is context-aware.

  • Type cd Do and press Tab -> Zsh completes to Documents/.
  • Type git a and press Tab -> Zsh suggests add, apply, archive, etc.
  • It can even navigate through options using the arrow keys after pressing Tab.

2. Spelling Correction

If you make a minor typo, Zsh often catches it.

  • Typing gut status instead of git status might prompt: zsh: correct 'gut' to 'git' [nyae]?

3. Path Expansion

You don't always need to type full paths.

  • Typing cd /u/lo/bi and pressing Tab can expand to /usr/local/bin.

Basic Shortcuts

  • Ctrl + U: Clear the current line.
  • Ctrl + A: Move cursor to the beginning of the line.
  • Ctrl + E: Move cursor to the end of the line.
  • Ctrl + R: Search through command history.

Next Steps

Once you are comfortable with the basics of Zsh, you can start customizing it to fit your workflow.

  • Configuration: Learn how to edit your .zshrc file, create aliases, and customize your prompt in the Advanced Zsh Configuration guide.
  • Scripting: Zsh is also a powerful scripting language. See Getting Started with macOS Tahoe for a basic scripting example.