Installing Composer Globally in Mac OSX El Capitan

The Problem

You want to use Composer but you’re not quite sure what you’re doing?

Apple have tightened up their security with the release of OSX El Capitan.

I am not hugely familiar with Composer and other command line interfaces. In order to learn I wanted to get Composer installed globally to make life a little easier.

Previously it was possible to drop the file in the /usr/bin folder and away you went. I had used this method before and it went very smoothly. This is no longer the case with El Capitan.

The Solution

Now you need to do the following:

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

Others have suggested that you can then run this command to install globally:

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

However, I found that I got an error saying that the directory didn’t exist, so I needed a further step to actually manually create the directory (I suggest in a separate Terminal window/tab so you don’t lose your place):

$ cd /usr/local
$ sudo makedir bin

Then you can run the command:

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

This should enable you to run Composer with the simpler command:

$ composer

Learn More AboutĀ Composer

Running the command above will return theĀ full list of functions available using Composer. You can also visit https://getcomposer.org/ for more information.

I hope this was useful for those like me that are just learning and have problems that more advanced developers overlook.

If you found this article helpful please do comment and share it around. Thanks for reading!