OSX -bash: composer: command not found

bobbybackblech picture bobbybackblech · Jul 29, 2014 · Viewed 131k times · Source

If i type "composer" i get the above error message.

I did on my macbook:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

to install Composer globally.

I had to manually create the /local/bin/composer directory, maybe this caused the error ?

php composer.phar

works if i in my code directory where the .phar file is.

What could i do to solve the problem and run composer globally ?

My ~/.profile

export PS1="\W: "
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx

~: echo $PATH

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/bin
~: 

Answer

deceze picture deceze · Jul 29, 2014

The path /usr/local/bin/composer is not in your PATH, executables in that folder won't be found.

Delete the folder /usr/local/bin/composer, then run

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

This moves composer.phar into /usr/local/bin/ and renames it into composer (which is still an executable, not a folder).

Then just use it like:

$ composer ...