Laravel PHP Command Not Found – How To Fix It


I was able to install Laravel using composer, however now when I try to type laravel it says the following:

-bash: laravel: command not found

When I read the documentation on the official site It says that I should do the following:

Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel
executable is found when you run the laravel command in your terminal.

However, being a newbie when it comes to the operating systems and using terminal, I am not sure how to do this.


So don’t sweat. Here’s what you need to do:

nano ~/.bash_profile

And paste

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

do source ~/.bash_profile and enjoy 😉

Important note: If you want to know the difference between bash_profile and bashrc please check below:

When you login (type username and password) via console, either sitting at the machine or remotely via ssh: .bash_profile is executed to configure your shell before the initial command prompt.

But, if you’ve already logged into your machine and open a new terminal window (xterm) inside Gnome or KDE, then .bashrc is executed before the window command prompt. .bashrc is also run when you start a new bash instance by typing /bin/bash in a terminal.

Note: For Ubuntu 16.04 running Laravel 5.1, the path is: 


About the author