How to install Composer on a Mac?

You can install it via Brew.

First, install Brew;

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then you can use Brew to install Composer;

brew install composer

That's it, it's now installed. You can verify this by running composer --version


  1. download file from https://getcomposer.org/installer

  2. execute the file

sudo php installer
  1. and move the file
mv composer.phar /usr/local/bin/composer

Here it is:

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

First install brew if not installed in Mac:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Update brew and install php and composer.

$ brew update
$ brew install php
$ brew install composer

Verify by checking version:

 $ composer -V

I hope it helps.


try

~ which php
/usr/bin/php

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