Installing Composer on Mac OS X Mountain Lion

I recently read about a package management system for PHP on NetTuts called Composer. It looked interesting but I hadn’t had time to play around with it. At work, though, a new project came up that called for using a package from Composer so I needed to figure out how to get it installed and working on my Macintosh running Mountain Lion. I followed the instructions in the article for installation but ran into some problems.

Running the curl command specified in the article:

$ cd /path/to/my/project
$ curl -s | php

gave me the following results:

Composer installation error

Doing some Googling, I found people mentioning that the solution is to problem is to edit the php.ini file. I couldn’t find a php.ini file in Mountain Lion but I did find a php.ini.default in theĀ /private/etc/ directory. So, I copied the php.ini.default file as php.ini and opened it up for editing. At the end of the file, I added the configuration:

detect_unicode = Off

Then, I reran the curl command. Composer was now installed but with a warning:

Composer Install Warning

So, I looked up the timezone for my location and added another option to my php.ini file:

date.timezone = America/New_York

Finally, success!


I then followed the directions in the NetTuts article to add Composer to my /usr/sbin/ directory and it worked like a charm.