How to Edit $PATH on MacOS Catalina (Zsh)

I open terminal and use echo $PATH

I get back /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin/

I'm confused because my .zshrc, .zsh, .bash_profile, .bashrc, and .profile all have nothing in it.

I don't have all these, but I enabled hidden folders and files to see if I did.

I looked in the default system's path. /etc/path to see if there was something there, but its just the defaults. I'm only worried because the file in there has something to do with remote packets, rvictl

2

1 Answer

On macOS, your $path gets prepopulated in /etc/zprofile:

% < /etc/zprofile
# System-wide profile for interactive zsh(1) login shells.
# Setup user specific overrides for this in ~/.zprofile. See zshbuiltins(1)
# and zshoptions(1) for more details.
if [ -x /usr/libexec/path_helper ]; then eval `/usr/libexec/path_helper -s`
fi
% man path_helper
path_helper(8) BSD System Manager's Manual path_helper(8)
NAME path_helper -- helper for constructing PATH environment variable
SYNOPSIS path_helper [-c | -s]
DESCRIPTION The path_helper utility reads the contents of the files in the directories /etc/paths.d and /etc/manpaths.d and appends their contents to the PATH and MANPATH environment vari- ables respectively. (The MANPATH environment variable will not be modified unless it is already set in the environment.) Files in these directories should contain one path element per line. Prior to reading these directories, default PATH and MANPATH values are obtained from the files /etc/paths and /etc/manpaths respectively. Options: -c Generate C-shell commands on stdout. This is the default if SHELL ends with "csh". -s Generate Bourne shell commands on stdout. This is the default if SHELL does not end with "csh".
NOTE The path_helper utility should not be invoked directly. It is intended only for use by the shell profile.
Mac OS X March 15, 2007 Mac OS X

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like