How to install Composer on a Mac?

Here it is:

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

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