zsh: command not found: laravel on Mac

by | Jan 5, 2021 | Tips | 0 comments

Nothing is more frustrating then when all you want to do is start coding and commands don’t work. Whether you are new to Laravel or like me reformat often forget how you resolved past problems. A common issue that affects Laravel developers is forgetting to place Comoser’s vendor pin directory in our $PATH. When following first-time setup installation instructions from laravel.com it instructs you to do the following.

Make sure to place Composer’s system-wide vendor bin directory in your $PATH so the laravel executable can be located by your system. This directory exists in different locations based on your operating system; however, some common locations include:

– macOS: $HOME/.composer/vendor/bin

– Windows: %USERPROFILE%\AppData\Roaming\Composer\vendor\bin

-GNU / Linux Distributions: $HOME/.config/composer/vendor/bin or $HOME/.composer/vendor/bin


Instead, simply add the following to the end of your ~/.zshrc file. Once completed open up a new terminal instance or sourcing the /.zshrc file that’s it!

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

You can check that everything is working by typing laravel -v