In macOS, the default shell is macOS. When you enter a command in the shell, macOS first checks the current directory for a corresponding program or script. If no program or script is found there, it then looks in all directories listed in the PATH variable.
The following describes how to add another directory to the PATH variable. First, create a file named .zshrc
in the user directory:
nano ~/.zshrc
In this file, add the desired directory, for example, ~/.composer/vendor/bin
. You can do this with the following entry:
export PATH="$HOME/.composer/vendor/bin:$PATH"
Next, you need to restart the shell or manually load the file using the following command:
source ~/.zshrc
Now, the desired directory has been added to the PATH variable and will be checked for programs and scripts accordingly.