Posts Learn Components Snippets Categories Tags Tools About
/

How to Fix Laravel Command Not Found on Mac

Learn how to fix Laravel command not found on MacOS machine the easy way

Created on Oct 23, 2021

1431 views

Often times after installing Laravel from the composer package manager, you face the "Laravel Command Not Found" error and the cause of this is that the executable "laravel" command is not found in the path. In this short snippet, you will learn how to fix and resolve this error.

Step 1: Open iTerm or Terminal


The first step is to open your Terminal and then make sure you are within your "user" path.
pwd
The "print working directory" above should output something like.
/Users/postsrc

Step 2: Update .zshrc or .bashrc


Depending on your terminal you might be using ZSH or Bash. If you are using ZSH then the config will be inside the ".zshrc" otherwise the ".bashrc" file.
Next, open and edit the file with "vim" editor by writing the command below.
vim .zshrc
or if you are using bash:
vim .bashrc
And then press "i" for interaction which allows you to edit the text and then paste the export line below using the command "command + v".
export PATH="~/.composer/vendor/bin:$PATH"
once you have done that, type in ":wq" (colon + wq) which will write and quit from the vim edit mode.

Restart/Refresh the Terminal


Do restart to refresh the terminal or otherwise just call the "source ~/.bashrc" or "source ~/.zshrc" to get the latest config you just updated.
source ~/.bashrc
source ~/.zshrc
Now do run the "laravel" command in the terminal and try whether it can be executable or not.
laravel

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

Load comments for How to Fix Laravel Command Not Found on Mac

)