Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to install composer to get set up with Laravel framework

I am trying to install composer on my Mac so that I can use the Laravel framework. I successfully downloaded composer through the terminal, and then I moved composer.phar to to usr/local/bin using the command: sudo mv composer.phar /usr/local/bin.

I then changed directories to my root directory where I have the laravel-master files. After changing to this directory in the terminal, and then using the command: composer install

I receive the error: -bash: composer: command not found

I have tried other variations (such as php composer.phar install, etc..), however, I keep receiving the same error.

Any help would be much appreciated. Thank you!

like image 206
user1072337 Avatar asked Jun 13 '13 05:06

user1072337


People also ask

How can we install Laravel by the composer?

Via Download. Once Composer is installed, download the 4.2 version of the Laravel framework and extract its contents into a directory on your server. Next, in the root of your Laravel application, run the php composer. phar install (or composer install ) command to install all of the framework's dependencies.

Where is Laravel composer installed?

Install Laravel 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. Once installed, the simple laravel new command will create a fresh Laravel installation in the directory you specify.

How do I know if Laravel composer is installed?

When you are done installing the Composer, cross-check whether it is installed or not by typing in the command prompt the composer command. You can see the Composer screen in that CMD only.

Why is composer needed for Laravel?

In Laravel, the composer is a tool that includes all the dependencies and libraries. It helps the user to develop a project with respect to the mentioned framework. Third-party libraries can be installed easily using composer. Composer is used to managing its dependencies and the dependencies are noted in composer.


4 Answers

Make sure that /usr/local/bin is in your $PATH

$ echo $PATH

Then execute

$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
                                       ^^^^^^^^ you didn't rename it 

For reference see

  • Installing composer.phar globally on *nix
like image 117
peterm Avatar answered Oct 19 '22 20:10

peterm


I'm running Mavericks and had same problem. I changed /usr/local/bin/composer to /usr/bin/composer and it worked for me.

like image 23
Wilson Sanchez Avatar answered Oct 19 '22 21:10

Wilson Sanchez


for mac os x Mavericks and Yosemite El capitan

Change

sudo mv composer.phar /usr/local/bin/composer

To

sudo mv composer.phar /usr/bin/composer

Now if you just write composer in terminal, it will show you all available commands

Then "if running MAMP" navagate you htdocs folder and run

composer create-project laravel/laravel laratest

Hope that helps

like image 18
Sabba Keynejad Avatar answered Oct 19 '22 19:10

Sabba Keynejad


A quick copy-paste version including sudo:

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
like image 14
Shaolin Fantastic Avatar answered Oct 19 '22 21:10

Shaolin Fantastic