By mrbagnall | 22 August 2015
If you've followed this blog or even specific entries on this blog, you will know I am not a proponent of MacPorts, Homebrew or other package management applications as they relate to OS X. Instead, I have chosen the "roll your own" route more than once.
On my blog entry for installing PHP with GD and other utilities on OS X without Homebrew,I have detailed the process that I prefer for maintaining these sorts of applications.
In the comments section of that blog, I was asked specifically about supporting http://xapian.org within this repository. While I have elected not to do that for the time being, I thought this would be a good opportunity to go over how you can add things to OS X using the "compile by source" model that I have selected. I understand that this takes more knowledge of how to compile and install software via a command line, but it really isn't a ton different than using package management utilities which also require the command line. And in the case of Xapian, there aren't that many more commands that you will need to run.
I am going to assume that installing Xapian with PHP bindings is what is desired, so that is my approach. You will need to download the latest sources for Xapian and the Xapian bindings. Once you have down so, move the tar.gz files to your desktop. Drop to your terminal and do the following
cd Desktop tar -xvzf xapian-core-1.2.21.tar.gz cd xapian-core-1.2.21 sudo ./configure sudo make sudo make install
This may take some time to complete based on the speed of your computer and its resources. Once that is finished, the shared library for Xapian should be available to your systems common install locations. To create the bindings, you will need to do something similar for the xapian-bindings-1.2.21.tar.gz file.
cd ~ cd Desktop tar -xvzf xapian-bindings-1.2.21.tar.gz cd xapian-bindings-1.2.21 sudo ./configure sudo make sudo make install
At some point during the binding process, you may get a popup window about Java if you do not have it installed. It tries to create a Java binding and if it does not exist, OS X will prompt you to install it or go to a URL to install it. You can choose to do this or not at your own discretion. Note that it will not install the bindings for any language that is not already installed on your Mac.
Once done, add extension=xapian.so to your /etc/php.ini file and re-start your apache web server. Pulling your phpinfo() for the server should then reveal you have the Xapian bindings installed and assigned to your web server.
Note that as of this blog post, Xapian is at version 1.2.21 - you may need to change the above to fit the versions available at the time you are attempting to install.