Laravel

How to Install Composer on mac / OSX

1. Open Terminal and paste these code and run

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '8a6138e2a05a8c28539c9f0fb361159823655d7ad2deecb371b04a83966c61223adc522b0189079e3e9e277cd72b8897') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

2. It will install composer locally. Now we need to move it globally

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

3. If you facing the following problem

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

Then run these command to create the expected directory.

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

And run these command again.

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

Now it should work. Done 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

September 2020
M T W T F S S
« Jul   Oct »
 123456
78910111213
14151617181920
21222324252627
282930  

Site Statistics

  • Users online: 0 
  • Visitors today : 13
  • Page views today : 13
  • Total visitors : 3,981
  • Total page view: 4,456