I am trying to add to my $PATH on MacOS (Monterey)

When I use

export PATH=$PATH:~/.composer/vendor/bin

It will add it to $PATH and I can see it when I use

echo $PATH

However when I reboot the computer, that item is removed from $PATH and needs to be added again.

Is there a way to permanently add it to the $PATH?

One thing I have noticed is that there is no ~/.profile file.

Do I need to make one and add something to it?

1 Answer 1


It depends on the shell you're using. If you use ZSH (the default shell for Catalina and newer systems) you should edit your .zshrc file (see more at https://stackoverflow.com/questions/11530090/adding-a-new-entry-to-the-path-variable-in-zsh).

If you use BASH I would edit both your .bashrc and your .bash_profile files (supplementary information under https://scriptingosx.com/2017/04/about-bash_profile-and-bashrc-on-macos/).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .