Reputation: 900
Just tried to install composer on my new Macbook Pro. Ran into an issue when I tried to install it globally. I'm not sure if this operating system related or not.
My Steps
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php
sudo php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
Problem
I can run composer if I access it directly. php composer.phar
works just fine. But I can't get it to work globally by moving it to the /usr/local/bin/composer
directory.
Question
Is this operating system related? And if you could shed anymore light onto the issue that would be great.
Upvotes: 2
Views: 5280
Reputation: 1293
To get it working globally, create the the bin directory
sudo mkdir -p /usr/local/bin
After that, simply move it to the directory you created.
sudo mv composer.phar /usr/local/bin/composer
Upvotes: 1
Reputation: 900
The answer is no, it is not operating system related.
In this case, I made the mistake of moving composer.phar
into a folder named composer. So the structure was this: /usr/local/bin/composer/composer.phar
. The correct approach is to rename composer.phar
to composer
, making the structure /usr/local/bin/composer
.
Upvotes: 4