Laravel PHP command not found

I installed Laravel using the composer without any 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 on the official website, I need to do this:

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

But I do not know how to do this (I am new to console console commands).

Can you help me? Thank!!

+144
bash php laravel
Oct. 15 '14 at 7:10
source share
17 answers

Ok, I did it and it works:

nano ~/.bash_profile 

And insert

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

Reboot the terminal and enjoy;)

It is important . If you want to know the difference between bash_profile and bashrc, please check the link

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

+223
Oct. 15 '14 at 7:24
source share

Add the following to your .bashrc (not .bash_profile ).

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

At the end of the file and then in the terminal

 source ~/.bashrc 

To verify this:

echo $PATH (Restart the terminal, check and confirm that there is a path)

Run the Laravel team!

+172
Jan 13 '15 at 5:19
source share

The solution is at http://tutsnare.com/laravel-command-not-found-ubuntu-mac/

In terminal

 # download installer composer global require "laravel/installer=~1.1" #setting up path export PATH="~/.composer/vendor/bin:$PATH" # check laravel command laravel # download installer composer global require "laravel/installer=~1.1" nano ~/.bashrc #add alias laravel='~/.composer/vendor/bin/laravel' source ~/.bashrc laravel # going to html dir to create project there cd /var/www/html/ # install project in blog dir. laravel new blog 
+62
Jul 04 '15 at 19:10
source share

When using a MacBook, refer to the snippets below;

For zsh:

 echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.zshrc source ~/.zshrc 

For Bash:

 echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc source ~/.bashrc 
+54
Aug 17 '16 at 7:57
source share

If you are using Ubuntu 16.04.

  • You need to find composer configuration files in my case:
    ~/.config/composer or in other cases ~/.composer/
    you can see the directory after this composer global require "laravel/installer"

  • After installing Laravel, you can find your laravel in ~/.config/composer/vendor/laravel/installer/ .
    and you will find the Laravel shortcut command here:
    ~/.config/composer/vendor/bin/

  • install your .bashrc using nano ~/.bashrc and export the composer configuration file:

    export PATH="$PATH:$HOME/.config/composer/vendor/bin"

    or you can use allias. but the solution above is recommended.

    alias laravel='~/.config/composer/vendor/laravel/installer/laravel'

  • Now update your bashrc using source ~/.bashrc and then laravel is ready!

above steps work with me in Ubuntu 16.04

+24
Jan 05 '17 at 3:40
source share

Type on terminal:

  composer global require "laravel/installer" 

When you finish the composer, enter:

 vi ~/.bashrc 

Insert and save:

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

Type on terminal:

 source ~/.bashrc 

Open another terminal window and type: laravel

+21
Aug 18 '16 at 15:25
source share

For zsh and bash:

 export PATH="$HOME/.config/composer/vendor/bin:$PATH" source ~/.zshrc source ~/.bashrc 

For bash only:

 export PATH=~/.config/composer/vendor/bin:$PATH source ~/.bashrc 
+17
Feb 08 '18 at 6:26
source share

For developers, use zsh Add the following to your .zshrc file:

vi ~/.zshrc or nano ~/.zshrc

 export PATH="$HOME/.composer/vendor/bin:$PATH" 

at the end of the file.

zsh doesn't know ~ , so use $HOME instead.

source ~/.zshrc

Done! try the laravel command you will see.

+11
Jul 04 '16 at 3:40
source share

For Linux users with Zsh:

1 - add this line to your .zshrc file

 export PATH="$HOME/.config/composer/vendor/bin:$PATH" 

2 - Launch

 source ~/.zshrc 
  • Linux path to composer folder is different from Mac
  • Use $HOME instead of ~ inside the path using Zsh
  • The .zshrc file .zshrc hidden in the Home folder
  • export PATH= exports the path in quotation marks so that the Laravel executable can be located on your system.
  • The: $ PATH should avoid overriding what was already on the way to the system.
+6
Apr 27 '17 at 2:32 on
source share

If on mac (and I think * nix) just run this in your terminal.

 export PATH="~/.composer/vendor/bin:$PATH" 
+5
Sep 01 '15 at 8:54
source share

1) First download the Laravel installer using Composer:

global composer requires "laravel / installer"

2) Be sure to put ~/.composer/vendor/bin directory in your PATH variable so that your system can find the laravel executable.

  set PATH=%PATH%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin eg: 'C:\Users\\AppData\Roaming\Composer\vendor\bin' 

3) After installation, a simple laravel new command will create a new Laravel installation in the directory you specify.

 eG: laravel new blog 
+4
Dec 28 '15 at 11:52
source share

I installed the WAY, but it did not work. I find another way to solve it. (OSX 10.10 and Laravel 5.2)
1) find the executable file:

 ~/.composer/vendor/laravel/installer/laravel 

2) give rights to perform:

 chmod +x ~/.composer/vendor/laravel/installer/laravel 

3) make a soft link to /usr/bin:

 sudo ln -s /Users/zhao/.composer/vendor/laravel/installer/laravel /usr/bin/laravel 
+4
Jun 05 '16 at 6:42
source share

For MAC users :

1. Open a terminal

 cd ~ 

2. Double check $ PATH

 echo $PATH 

3. Change file

 nano ~/.bash_profile 

4. PASTE

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

Do not forget to put quotation marks.

5. control + X (y + input to save the file and exit)

Now run vagrant, go to your folder and try:

 laravel new yourprojectname 
+4
Feb 02 '18 at 20:09
source share

enter on terminal:

 nano ~/.bash_profile 

then paste:

 export PATH="/Users/yourusername/.composer/vendor/bin:$PATH" 

then save (press Ctrl + C, press Y, press Enter)

Now you are ready to use "Laravel" on your terminal

+1
Oct 08 '18 at 9:27
source share

When I went in to add the export PATH = "$ HOME / .composer / vendor / bin: $ PATH" to my ~ / .bashrc file, vim told me that it was a new file. I tried the same for the .zshrc file, and vim said it was new too. I went ahead and added it to the newly created ~ / .bashrc file and ran laravel again and got the bash command: laravel not found.

I suggest that I either insert this line into the wrong .bashrc file. I can not find the file where I have to paste this.

0
Jul 19 '17 at 13:06 on
source share

If you have Composer installed globally, you can install the Laravel installation tool using the following command:

 composer global require "laravel/installer=~1.1" 
0
Jun 18 '18 at 10:16
source share

Just use this:

 composer create-project --prefer-dist laravel/laravel youprojectname 
0
Aug 22 '19 at 13:37
source share



All Articles