Laravel PHP Command Not Found

chemitaxis picture chemitaxis · Oct 15, 2014 · Viewed 195.2k times · Source

I have installed Laravel using composer without problems, but when I try to execute "laravel" in my terminal I have this typical error:

-bash: laravel: command not found

If I read the documentation of the official site I need to do that:

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.

But I don't know how to do (I'm new on terminal console commands).

Can you help me with that? Thanks!!

Answer

chemitaxis picture chemitaxis · Oct 15, 2014

Ok, I did that and it works:

nano ~/.bash_profile 

And paste

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

do source ~/.bash_profile and enjoy ;)

Important: If you want to know the difference between bash_profile and bashrc please check this link

Note: For Ubuntu 16.04 running laravel 5.1, the path is: ~/.config/composer/vendor/bin

On other platforms: To check where your Composer global directory is, run composer global about. Add /vendor/bin to the directory that gets listed after "Changed current directory to ..." to get the path you should add to your PATH.