2 min read

Terminal Basics and Zsh Customization on macOS Tahoe

The Terminal provides direct access to the Unix underpinnings of macOS. Since macOS Catalina, the default shell has been Zsh (Z shell), which offers many improvements over the older Bash shell, including better tab completion and theming capabilities.

Basic Navigation

Navigating the file system via the command line relies on a few core commands:

  • pwd: Print Working Directory. Shows you exactly where you are in the file system.
  • ls: List files.
    • ls -la: List all files (including hidden ones) with details (permissions, size).
  • cd: Change Directory.
    • cd Desktop: Go to the Desktop folder.
    • cd ..: Go up one folder level.
    • cd ~: Go to your Home folder.

Essential File Operations

  • touch filename.txt: Create a new, empty file.
  • mkdir foldername: Make a new Directory.
  • cp source destination: Copy a file.
  • mv oldname newname: Move or rename a file.
  • rm filename: Remove (delete) a file. Warning: This does not move files to the Trash; it deletes them permanently.

Customizing Zsh

Zsh is highly customizable. Its configuration lives in a hidden file in your home directory called .zshrc.

Editing .zshrc

  1. Open the file in a text editor: nano ~/.zshrc
  2. Add configurations, aliases, or environment variables.
    • Alias Example: alias ll="ls -la" (Now typing ll runs ls -la).
  3. Save (Ctrl+O, Enter) and Exit (Ctrl+X).
  4. Apply changes: source ~/.zshrc

Oh My Zsh

The most popular way to manage Zsh configuration is Oh My Zsh, a community-driven framework.

1. Installation

Run the following command in your terminal (requires git and curl):

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

2. Themes

Oh My Zsh comes with many themes. To change your theme:

  1. Open ~/.zshrc.
  2. Find the line ZSH_THEME="robbyrussell".
  3. Change it to another theme, like ZSH_THEME="agnoster" (requires Powerline fonts) or ZSH_THEME="bira".

3. Plugins

Enable plugins to add functionality. Find the plugins=(git) line in ~/.zshrc and update it:

plugins=(git macos z)
  • macos: Adds commands like showfiles (unhide files) and pfd (print path of frontmost Finder window).
  • z: Tracks your most visited directories, allowing you to jump to them with fuzzy matching (e.g., z project).
  • Reading Manual Pages with Man on macOS Tahoe
  • Launching Apps and Files with Open on macOS Tahoe
  • Master Guide to macOS Tahoe