Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Kudos's avatar

Composer doesn't work, OSX El Capitan.

I've just installed composer using curl -sS https://getcomposer.org/installer | php and it works so far, I can move it using sudo mv composer.phar /usr/local/bin, but when I'm trying to run nothing works. I've tried composer.phar, php composer.phar and php composer. What to do?

0 likes
24 replies
Kudos's avatar

I've nothing more than the above, and when I try to invoke it, it just says -bash: composer: command not found.

bugsysha's avatar

Give us output of ls -la /usr/local/bin/composer.phar

Kudos's avatar

ls: /usr/local/bin/composer.phar: Not a directory

bugsysha's avatar

Execute this.

ls -la /usr/local/bin/composer.phar
bugsysha's avatar

I know but you did something wrong. Paste what I wrote to your console and execute it and after that give us the output.

Kudos's avatar

I posted yours and it responded with: ls: /usr/local/bin/composer.phar: Not a directory

bugsysha's avatar

Google for "not a directory" error and find solution ;)

Kudos's avatar

I've done that before consulting this forum ;o) It tells me that /bin is a not directory and I can't cd into it.

sitesense's avatar

I used this on Yosemite and it worked just fine.

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

EDIT: Just had another look and I think I know where you went wrong. You renamed composer to 'bin' overwriting the folder:

and it works so far, I can move it using sudo mv composer.phar /usr/local/bin

1 like
Kudos's avatar

Mine respond with: "mv: rename composer.phar to /usr/local/bin/composer: Not a directory", I'm starting to think that something has changed in El Captitan, I had no problems on Yosemite either.

Kudos's avatar

Oh, how can I change this? :O

sitesense's avatar

You're pretty stuffed unless you have a backup of the 'bin' folder. I'm not sure what else you have installed over a stock El Capitan but I guess you're missing a bunch of stuff now.

Kudos's avatar

Maybe it's time for a fresh installation ;o) :-/

bugsysha's avatar

Or maybe you can copy it from someone. But I guess fresh installation would be the best option.

cragthehack's avatar

Or if you have Time Machine running; backing up the whole system, you can restore from there. Make sure you "un-hide" the system files first before checking. By default, TM grabs the whole system.

alenabdula's avatar

@Kudos

EDIT: Just had another look and I think I know where you went wrong. You renamed composer to 'bin' overwriting the folder:

/bin is a folder, he's moving a executable. So I doubt he renamed his bin folder.

ls -la /usr/local/bin/composer.phar

composer.phar is not a directory, it's a file so ls gives correct response.

If you did sudo mv composer.phar /usr/local/bin you just moved the the composer.phar to bin folder without renaming it.

Composer documentation says:

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.

See: https://getcomposer.org/doc/00-intro.md#globally

1 like
jimmck's avatar

@alenabdula please type

which composer.phar

from a command line and paste it here. I had some fun with the 'Captain' but composer was fine.

Kudos's avatar

My /usr directory exist, I can cd into it, but I can't cd into usr/local/bin, not even after a fresh install? I can cd into /usr/local, but that's it.

bugsysha's avatar

Do this

cat /usr/local/bin

or this

tail /usr/local/bin

and this

ls -la /usr/local
Kudos's avatar

The solution was to create the directory manually. Thanks for your time everyone :o)

Please or to participate in this conversation.