2
votes

When I install composer on my mac with:

curl -sS https://getcomposer.org/installer | php

And then try to move it like this:

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

it's telling me:

rename composer.phar to /usr/local/bin/composer: No such file or directory

When I look to my path:

echo $PATH

It's telling me:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

That can't be right I guess, I'm not very familiair with composer what should I do?

Thankyou

2
Oke it's telling me that I;ve to make this directory but how can I do this?Jamie

2 Answers

9
votes

Try with below command to install composer globally.

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=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: sudo mkdir -p /usr/local/bin.

7
votes

If you are running macOS Sierra Version, there might not be a /usr/local/bin folder so you will have to create it. Follow these steps in the terminal:

Step 1: cd ~

Step 2: sudo mkdir -p /usr/local/bin

Step 3: curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer