Composer [Mac] - Unable to use composer command on cmd

1.3k views Asked by At

I haven't been able to install composer into my mac (running macOS Sierra) ever since I got it some time ago.

I was able to download composer into my mac and then place the composer.phar file into the usr/local/bin/composer directory, but when I try to run the composer command on cmd it retrieves:

-bash: composer: command not found

I'm getting desperate now. I haven't been able to develop since 3 months ago. Please help :(

2

There are 2 answers

0
Alexey Shokov On

I would advice to use Homebrew to install/upgrade Composer (and all other software on your Mac!). It's a "default" package manager in the community at the moment.

Just install Homebrew and then — Composer

brew install composer
0
Antonio Carlos Ribeiro On

There should be no /usr/local/bin/composer directory, but /usr/local/bin. So, make sure you install it correctly:

Delete the folder

$ sudo rm -rf /usr/local/bin/composer

Download it again, then move it this way:

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

Then make sure /usr/local/bin is in your path

$ echo $PATH

And you must see

$ /usr/local/bin

If it's not in your path you'll have to add this to your .bashrc (or whatever you are using as command line):

$ export PATH=$PATH:/usr/local/bin

And you should be good to

composer update