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.


  1. Thanks for your post. Its helped configure composer in my new mac.
    One thing i would like to add is the possibility to start composer with an alias, because of my laziness; in my ~/.profile (or ~/.bash_profile) I add this line “alias composer=’php /PfadToComposer/composer.phar'” without quotes of course.

Leave a comment

Your email address will not be published. Required fields are marked *