Install Composer Macbook Pro Yosemite

Installing Composer on OS X

Composer is a cross-platform dependency manager for PHP libraries. This article will explain how to install it on OS X and add an alias so you can use it from anywhere.

Installing

The first step is to download Composer, which will effectively create a Phar (PHP Archive) file called composer.phar. From your terminal, run the following command:

Installation Errors

In some cases, you might receive the following error:

For OS X 10.8, the php.ini file should be located in /private/etc/. If you don’t have one already, you can copy the default one:

Then, edit the file and append the following to it:

Save the file and rerun the curl command above.

Running Composer

The resulting file will be called composer.phar, a PHP Archive that can be executed directly via PHP. However, in my case, I want Composer to be accessible globally by simply typing composer. To do this, move it to/usr/bin/ and create an alias:

Add this to your .bash_profile. It may be empty or non-existent, so go ahead and create it:

Now, relaunch your terminal and you’ll be able to access Composer simply by calling composer.