Configuring the Zsh Profile and PATH on macOS Tahoe
The .zshrc file is the configuration script for the Z shell (Zsh), which is the default shell on macOS Tahoe. It runs every time you open a new terminal window. This file is the place to set up your environment variables (like PATH), define aliases, and customize your prompt.
Locating the File
The .zshrc file is located in your home directory (~). Because it starts with a dot, it is hidden from the Finder by default.
To check if it exists:
ls -a ~
If you don't see it, you can create it:
touch ~/.zshrc
Editing .zshrc
You can edit this file with any text editor.
Using Nano (Terminal Editor):
nano ~/.zshrc
Using TextEdit:
open -e ~/.zshrc
Setting the PATH Variable
The PATH variable tells the shell where to look for executable programs. If you install a tool (like Python, Node.js, or Go) and the terminal says "command not found," you likely need to add its location to your PATH.
To add a new directory to your PATH, add this line to the bottom of your .zshrc file:
export PATH="/path/to/directory:$PATH"
export PATH=: This sets the variable."/path/to/directory": The new folder you want to include (e.g.,/opt/homebrew/binor~/bin).:$PATH: This appends the existing PATH to your new definition, ensuring you don't lose access to system commands likelsorcd.
Example: Adding a user bin folder:
export PATH="$HOME/bin:$PATH"
Applying Changes
Changes to .zshrc do not take effect immediately in open windows. You must reload the configuration:
source ~/.zshrc
Related Guides
- Terminal Basics and Zsh Customization on macOS Tahoe
- Launching Apps and Files with Open on macOS Tahoe