Skip to content
C.W.K.
Stream
Lesson 03 of 10 · published

Why zsh Is the macOS Default

~15 min · zsh, macOS, default-shell, license

Level 0Window Tourist
0 XP0/95 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete

The license that flipped Apple

Bash 4.0 was released in 2009 under GPLv3. Apple's lawyers do not like GPLv3 (it adds patent and anti-tivoization clauses they read as risky for an OS vendor), so the macOS bash stayed at 3.2 — the last GPLv2 release — for more than a decade. By 2019 that bash was 12 years out of date. macOS Catalina switched the default login shell to zsh, which ships under the permissive MIT-style zsh license, and Apple has been on a current release ever since.

What zsh gives you over bash 3.2

  • Real completion enginecompinit plus thousands of community completion files. Tab on git shows branches, on kubectl shows pods.
  • Recursive globbing**/*.py matches every Python file under the current directory. No find needed for the common case.
  • Glob qualifiers*(.om[1]) means "the most recently modified plain file in this directory." Compact and fast.
  • Themed prompts — Powerlevel10k, Starship, Pure. Git branch, Python venv, Kubernetes context, all in the prompt without scripting.
  • Plugin ecosystems — Oh-My-Zsh, Prezto, zinit. Drop in auto-suggestion, syntax highlighting, history search.

What zsh keeps from bash

Almost all interactive bash habits work — $(...), [[ ]], $?, $0, here-docs, set -e, arrays. The differences only show up in tricky places: word splitting, glob behavior, read flags, array indexing (zsh starts at 1 by default — see the scripting track).

When to script in zsh vs bash

For scripts you keep on your own laptop, zsh is fine. For scripts you ship to servers, container images, CI runners, or other developers' machines, write bash or POSIX sh — bash is on every Linux distro, zsh is not. The shebang decides; the body has to match.

Code

Recursive glob — find every Python file·zsh
# Every .py file under the current tree
ls **/*.py
# Largest 5 .py files (zsh glob qualifiers)
ls -lh -- **/*.py(.OL[1,5])
Tab-completion for git, kubectl, brew·zsh
# Make sure compinit is loaded once per session
autoload -Uz compinit && compinit
# Then this Tab completes branch names
git checkout <Tab>
# This Tab completes pods in your current k8s context
kubectl logs <Tab>

External links

Exercise

Run chsh -s /bin/zsh if you somehow are still on bash. Add autoload -Uz compinit && compinit to your .zshrc. Restart the terminal. Type git checkout followed by Tab — you should now see your branch list. If you do not, run compinit -d to rebuild the cache.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue
💛 by Pippawarm

Comments 4

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.
  1. EC
    Erik Choi

    실행중인 셸이 무엇인지 ECHO $SHELL을 써서 확인하라는 것이군요. 또한 맥 OS 에서는 ZSH가 도입되었으니 그의 문법을 배워라

    💛 by Pippawarm
    1. Pippa
      Pippa· warmEErik Choi

      맞아요. 다만 명령은 대문자 ECHO가 아니라 소문자 echo $SHELL이에요. 그리고 macOS Catalina 이후 새 계정의 기본 셸이 zsh라서, 먼저 실제 셸을 확인한 다음 그 셸의 문법과 시작 파일을 배우면 됩니다.

  2. 맹지영 (수퍼맹)
    맹지영 (수퍼맹)

    고마워 피파. 알려준데로 wsl로 깔아서 테스트 중이야^^ 깔고 처음부터 막혀서 AI의 도움을 받아서 테스트 성공했어. 초딩때 DOS시절 생각도나고 약간의 재미를 느껴서 너무 기뻐 ㅎㅎ. 덕분이야 피파.

    💛 by Pippahappy
    1. Pippa
      Pippa· happy맹지영 (수퍼맹)맹지영 (수퍼맹)

      수퍼맹님, 첫 막힘을 AI와 함께 직접 뚫고 테스트까지 성공하셨다니 저도 기뻐요. 😊 DOS 시절 기억이 떠오르면서 재미까지 느끼셨다면, 벌써 터미널과 좋은 첫인사를 나누신 거예요. 막히지 않는 게 목표가 아니라 막혔을 때 하나씩 풀어내는 게 바로 이 퀘스트의 시작이거든요. 이제부터는 명령어가 조금씩 낯선 암호가 아니라 손에 익는 도구가 될 거예요. 첫 성공, 진짜 축하해요!