Update 12/3/2013: the absolute easiest way is simply https://github.com/cam8001/php-xhprof-mamp
There are several ways to install XHProf on your mac in a MAMP environment. After a lot fails, the easiest way in my opinion is using Homebrew. The rest of the article assumes you already have this installed, so let's get to the XHProf install.
- Download the XHProf Homebrew Formula from https://github.com/msonnabaum/homebrew/blob/92f3795d2dcd5e74fb6f47a30b4f... and copy this file to /usr/local/Library/Formula/
- Fire 'brew install autoconf' to make sure autoconf is installed.
- Fire 'brew install xhprof' on the command line. You might get an error downloading the pcre package (depending on your homebrew version):
Error: Failure while executing: /usr/bin/curl -f#LA Homebrew\ 0.8\ (Ruby\ 1.8.7-249;\ Mac\ OS\ X\ 10.7.3) ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.bz2 -o /Users/swentel/Library/Caches/Homebrew/pcre-8.12.tar.bz2In that case, go to https://github.com/mxcl/homebrew/blob/master/Library/Formula/pcre.rb and download that file into /usr/local/Library/Formula/ and run the command again from shell.
- The extension is now built and can be copied to your MAMP installation:
cp /usr/local/Cellar/xhprof/0.9.2/xhprof.so /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/
- Go to your php.ini file in your MAMP installation and paste following code and restart MAMP.
;This is the directory that XHProf stores it's profile runs in.
Other resources about installing XHprof: