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.
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.
Hi Hendrik,
Thanks very much for your advise. I tried this but to no avail before using my colleagues install_name_tool file.
Thanks for the install_name_tool binary saved my day!!
No problem at all manika. I am glad I saved you some time with solving this issue.
Colin, you are a gentleman and a scholar. This worked perfectly for me following a frustrating few hours – many thanks!
No problem at all Chris. Glad to be of service :)
Worked a charm for me. Thanks!
Thanks Oliver. I am glad I could help.
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! :)
No problem Emil.
I am glad that this blog post helped you with your problem :)
After several hours of research and looking for install_name_tool.. your blog saved me..
Thanks a lot for the file Colin!!
No problem at all Siva. I am very glad that I could help :)
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.
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!
No problem at all Vladimir, I am glad I could help :)