Issues installing composer correctly on OS X El Capitan

Ad

I know there are some questions about how to install composer on SO, but they did not help me.

I am trying to install composer (for laravel). I have OS X El Capitan.

I downloaded composer like this:

$ curl -sS https://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for using Composer
Downloading...

Composer successfully installed to: /Users/blckbird/composer.phar
Use it: php composer.par

Next, I tried to execute the laravel installation:

composer global require "laravel/installer"

Which did not work because:

-bash: composer: command not found

So I tried:

sudo mv composer.phar /usr/local/composer

Which worked, however, I still can not execute composer (same error as above).

What am I doing wrong and how can I install composer correct?

Ad

Answer

Ad

Since your composer.phar is installed in /Users/blckbird/, try this for global installation:

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

Note: On some versions of OSX the /usr directory does not exist by default. If you receive the error "/usr/local/bin/composer: No such file or directory" then you must create the directory manually before proceeding: mkdir -p /usr/local/bin. More info.

Ad
source: stackoverflow.com
Ad