How I fixed Homebrew PHP complier error with Mac OSX 10.9 update

How I fixed Homebrew PHP complier error with Mac OSX 10.9 update

A few weeks I updated to Mac OSX 10.9. A few days later I wanted to install PHP 5.5 and when I tried using homebrew which I already had installed I got the following error:

configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no

After posting this gist up on Homebrew and trying multiple solutions this is how I solved the issue.

I spent numerous hours of installing and reinstalling homebrew, xcode, command line tools and nothing worked until I came across a comment about a file not updating with xcode and this is how I ended up fixing the issue.

Please note that this may not work for you if your try but I wanted to leave it known that this way my solution and hopefully save someone hours and hours of frustration,

1. Uninstall Homebrew

Firstly I uninstalled Homebrew. I followed the comment here on super user.

cd `brew --prefix`
rm -rf Cellar
brew prune
rm `git ls-files`
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
rm -rf .git
rm -rf ~/Library/Caches/Homebrew

2. Update the install_name_tool file

After weeks of searching I found this comment on github which stated that for some reason when you update xcode it was not updating the install_name_tool file which was causing an error with the compiler.

This file can be found under usr/bin/install_name_tool. It was recommended to try a reinstall of Xcode or then try a reinstall of OSX. Now I didn’t want to go and reinstall OSX 10.9 so I contacted my colleague Eoghan O Brien for his install_name_tool as he had also updated to 10.9 with no problems with homebrew.

I then replaced the install_name_tool file under /usr/bin. I have zipped up this file which you can download and try at your own risk here.

3. Reinstall Homebrew

I then reinstalled homebrew with the following steps from the wiki:

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
brew doctor
brew update
brew install php55

Conclusion

After weeks of frustration it was great to have a PHP install via Homebrew again as it was really difficult having to install manually Xdebug and other libraries. I hope this will help someone who ran into the same difficulties as I did with the update to OSX 10.9.

Tags:

15 ResponsesSubscibe to the Comments FeedAdd Comment

  1. Hendrik wrote on

    I solved this issue by downloading and installing the “command line tools for osx mavericks” from the Apple Developer site. It’s probably not a good idea to manually replace files in ‘/usr/bin’ as it might get you into trouble in regard to updates from Apple.

    • Colin wrote on

      Hi Hendrik,

      Thanks very much for your advise. I tried this but to no avail before using my colleagues install_name_tool file.

  2. manika wrote on

    Thanks for the install_name_tool binary saved my day!!

    • Colin wrote on

      No problem at all manika. I am glad I saved you some time with solving this issue.

  3. Chris Ballard wrote on

    Colin, you are a gentleman and a scholar. This worked perfectly for me following a frustrating few hours – many thanks!

    • Colin wrote on

      No problem at all Chris. Glad to be of service :)

  4. Oliver Northam wrote on

    Worked a charm for me. Thanks!

    • Colin wrote on

      Thanks Oliver. I am glad I could help.

  5. Emil wrote on

    Thanks for the blog post! Saved me tons of time when trying to figure out at similar problem. I had no install_name_tool file, but now I have! :)

    • Colin wrote on

      No problem Emil.

      I am glad that this blog post helped you with your problem :)

  6. siva wrote on

    After several hours of research and looking for install_name_tool.. your blog saved me..

    Thanks a lot for the file Colin!!

    • Colin wrote on

      No problem at all Siva. I am very glad that I could help :)

  7. Ritesh wrote on

    I was trying to install mysql, but got many warnings, including that of install_name_tool. I reinstalled Xcode, but was reluctant to reinstall OSX. Thanks for offering an alternate solution. mv & cp wouldn’t work without sudo though.

    I also decided to uninstall and reinstall Homebrew. While reinstalling I got a message that the path had changed.

    ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

    Please update.

  8. Vladimir wrote on

    You just saved my day with this binary ! I’m using command line tools and had no need to download XCode just because of one file. Thanks!

    • Colin wrote on

      No problem at all Vladimir, I am glad I could help :)

Leave a Reply

css.php