Home / Snippets / How to Place Composer Bin Directory in PATH in MacOS or Linux
How to Place Composer Bin Directory in PATH in MacOS or Linux cover

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

7.2K

2 years ago

0 comments

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".
/Users/YOUR-USER-NAME/.bashrc

For zsh Terminal


For zshrc then it will be located below, the name of the file will be "zshrc".
/Users/YOUR-USER-NAME/.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
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

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

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this