Sometimes I find myself working backwards up a tree of errors to fix a problem. Today was a case in point.

Since I’ve been doing a bit of WordPress grooming, I have the development build checked out locally. Previously I had run phpunit against the unit tests included in the code, but for some reason when I tried to run things under NetBeans, it would error out (Bug 247704).

So today I started playing with things again, only to see an error at the command line about a missing library:

A little bit of Googling and I find that the version of PHP that ships with Yosemite doesn’t include the PNG library. So mystery partially solved – when I upgraded to Yosemite, the version of PHP that I’d loaded with HomeBrew previously was replaced by the one that comes from Apple.

The Stack Overflow post says you can fix this by installing PHP from HomeBrew, which I have installed already (I used it to install node.js).

I had forgotten that I had HomeBrew installed, so I started off with that install, only to get an odd error message:

OK, so looks like I already have it, but since I’m not sure if it was from before I upgraded OS X to Yosemite, I do a check, only to get an error:

More Googling gets me to a thread on the HomeBrew site talking about an update for Yosemite ( and a couple of workarounds people have tried. It occurs to me that since the version of Ruby was changed with this update, I could use a trick I’ve used in the past and just add a symlink in Ruby framework folder to get HomeBrew to use the 2.0 Ruby:

Now I’m able to run the command to reinstall without the interpreter error, but … apparently the /usr/local folder is not writable.

Running ‘brew doctor’ shows me a bit more about this problem:

So I update the permissions of the /usr/local to allow me to write to it only to get some more errors

So following the steps outlined by brew itself, I clean things up a bit, and finally I’m successful in getting brew to update. Then I install PHP 5.6 using “brew install php56”.

Running the phpunit from the command line again, I get a bunch of errors, but these are all because the unit tests expect an empty database to start with (the failure I was getting before meant the test DB didn’t get cleared out).

So clean out the DB, and now my tests from the command line work (well except for a couple of actual test failures, but no more PNG error):

Still didn’t completely fix my NetBeans error, but at least now I can unit test WordPress and figure out if there are things I can contribute to that community.