Posts Learn Components Snippets Categories Tags Tools About

How to Place Composer Bin Directory in PATH in MacOS or Linux

Learn how to set up composer/vendor/bin directory PATH in MacOS or Linux machine

Created on Oct 17, 2021


For macOS or Linux Users

For macOS users, it's common to specify the path of the "composer vendor bin" directory in ".bashrc" and ".zshrc" and this file is usually located inside the base path of the user directory. On your terminal cd to "/" and it will bring you to this directory.
cd /

For bash Terminal

If you are using bash terminal then the location of fill will be as follows. The file name would be "bashrc".

For zsh Terminal

For zshrc then it will be located below, the name of the file will be "zshrc".

Specify the Export Path

The next step is to specify the export path of the "composer vendor bin" to the "bashrc" or "zshrc" file and it's like below.
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc

# If you are using zshrc
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.zshrc

Load the source

Finally, you can load the source from the source like the following which otherwise you will have to restart your terminal.
source ~/.bashrc

# If you are using zshrc
source ~/.zshrc

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️