Error Codes Wiki

Mac Terminal Errors — Common Command-Line Errors and Fix Guide

Informationalapplication

Overview

Fix common Mac Terminal errors including 'command not found', 'permission denied', PATH issues, shell configuration problems, and zsh vs bash differences.

Key Details

  • macOS uses zsh as the default shell since macOS Catalina (previously bash)
  • Configuration file is ~/.zshrc for zsh (not ~/.bashrc or ~/.bash_profile)
  • PATH determines which commands are available — Homebrew adds /opt/homebrew/bin to PATH
  • 'command not found' usually means the tool is not installed or not in PATH
  • 'Operation not permitted' in Terminal may require Full Disk Access permission

Common Causes

  • Command not installed or its path not in the shell's PATH variable
  • Using bash configuration files (.bashrc) when the shell is zsh
  • Homebrew PATH not configured: /opt/homebrew/bin not in PATH on Apple Silicon
  • Permission denied on scripts missing execute permission (chmod +x needed)
  • Terminal lacking Full Disk Access for operations on protected directories

Steps

  1. 1Check which shell: echo $SHELL (should show /bin/zsh on modern macOS)
  2. 2Fix PATH for Homebrew: add eval "$(/opt/homebrew/bin/brew shellenv)" to ~/.zshrc
  3. 3After editing ~/.zshrc: source ~/.zshrc or open a new terminal window
  4. 4Fix 'command not found': verify installation with which <command> or brew install <command>
  5. 5Fix 'permission denied': chmod +x script.sh to add execute permission
  6. 6Grant Full Disk Access to Terminal: System Settings > Privacy & Security > Full Disk Access > add Terminal

Tags

terminalzshcommand-not-foundpathshell

Related Items

More in Application

Frequently Asked Questions

Apple switched to zsh in Catalina because newer bash versions use GPLv3 license which Apple cannot bundle. Zsh is mostly compatible with bash but uses different config files (.zshrc vs .bashrc).