PHP with Homebrew

Tapping a new feature

Homebrew is pretty damn sweet if you are a developer on Mac OS X. It’s the package manager that doesn’t suck.

But the developers that run Homebrew aren’t PHP developers. And their official policy of not providing a formula (homebrew’s name for a “package”) for software already included in Mac OS X means that PHP wasn’t going to be available in Homebrew.

This is a pretty big problem considering many PHP developers need to test their application against a newer version of PHP than what Apple provides. Fortunately, they recognized this was an issue, found a PHP developer that was interested in this problem space and came up with a generalized solution to "how do we give specialized developers better control of Formulas in their field?"

The new Homebrew 0.9 adds a new command, brew tap, that allows you to “tap” a an alternative source of Homebrew formulas. (You can figure out if you have Homebrew 0.9 with brew -v. If you’re not up-to-date, simply brew up!)

And, (bonus!) there's already an official tap for PHP formulas. Setting up your homebrew install to use the new PHP tap is incredibly easy. Just: brew tap josegonzalez/php. And you’re good to go!

So far I’ve only had a chance to try out 3 of the PHP formulas:


brew install php53-xhprof
brew install php53-xdebug
brew install php53-uploadprogress

But it’s already saved me an immense amount of time. Installing Xdebug, xhprof and the uploadprogrss pecl needed by Drupal in under one minute? Priceless.

Looks like there’s formulas for apc, mongo, solr, memcached and several others. Go nuts!

There also might be a way to have multiple versions of PHP installed. See https://github.com/josegonzalez/homebrew-php/issues/8
I’ll let others figure that out and report back. :-)

Topic

Posted in

Mini blog

Comments

Add new comment