A shell is the program that reads what you type in Terminal and tells your Mac what to do. It's the interpreter between you and the operating system.

On modern Macs, the default shell is zsh. Older Macs used bash.

How It Works

  1. You open Terminal
  2. Terminal starts a shell (zsh)
  3. You type a command
  4. The shell interprets it and runs it
  5. The shell shows you the result

The shell is the brain. Terminal is just the window.

zsh vs bash

Feature bash zsh
Default on Mac Before 2019 2019 and later
Tab completion Basic Advanced
Spelling correction No Yes
Plugin ecosystem Limited Rich (Oh My Zsh)
Config file .bash_profile .zshrc
Script compatibility Very high High

For daily use, they're almost identical. The basic commands work the same in both.

Check Your Shell

echo \$SHELL

Output:

  • /bin/zsh - You're using zsh
  • /bin/bash - You're using bash

Why Apple Switched to zsh

Two reasons:

  1. Licensing: Newer versions of bash use a license Apple didn't want to include
  2. Features: zsh has nicer interactive features

The bash that shipped with Mac was from 2007. Apple couldn't update it without license complications, so they switched to zsh.

What This Means for You

For basic Terminal use: nothing changes. Commands like cd, ls, mkdir, cp, mv work exactly the same.

The main difference: your config file is now ~/.zshrc instead of ~/.bash_profile.

Config File Locations

Shell Config file
zsh ~/.zshrc
bash ~/.bash_profile or ~/.bashrc

This is where you add aliases, PATH modifications, and customizations.

Other Shells

There are more shells available:

Shell Known for
zsh Modern, feature-rich (Mac default)
bash Universal, reliable (Linux default)
fish User-friendly, colorful
sh Original, minimal

You can install and switch to any of them, but zsh or bash are the practical choices for Mac.

Switching Shells

To switch to bash:

chsh -s /bin/bash

To switch back to zsh:

chsh -s /bin/zsh

Restart Terminal for the change to take effect.

Shell vs Terminal App

Don't confuse the shell with the Terminal app:

Term What it is
Terminal.app The window application
Shell (zsh) The command interpreter inside
iTerm2 Alternative terminal app (same shells)

You can run zsh in Terminal.app or iTerm2 or any other terminal application. The shell is the same.

Shell Scripting

When you write a script (a file with commands), you specify which shell should run it:

#!/bin/bash
echo "This runs in bash"
#!/bin/zsh
echo "This runs in zsh"

For simple scripts, both work. For complex scripts or maximum compatibility, bash is often preferred.

The Practical Takeaway

  • You're probably using zsh (the Mac default)
  • Basic commands work the same as bash
  • Your config file is ~/.zshrc
  • Don't overthink it - use what your Mac gives you

Keep Learning

Understanding shells helps when you need to customize your Terminal. The free course covers these concepts.

Check it out at Mac Terminal for Humans.