Oct 15

How to Compile and Install Xdebug for MAMP (Snow Leopard)

  1. Download Xdebug
  2. Open a terminal window and run:

    export CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" 
    export CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" 
    export CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" 
    export LDFLAGS="-arch i386 -arch x86_64 -bind_at_load"
    
  3. Copy the output from php_info(), and paste it into the Xdebug Tailored Installation Instructions page.

  4. Follow the instructions listed on that page, in the same terminal window you executed the export commands.
  5. You’re done! Enjoy the latest and greatest Xdebug!

A little background:

The key to getting Xdebug to compile and work properly with MAMP is to compile it as a 32 and 64 bit Universal Binary. By setting those compiler variables, the compiler will create a compatible binary for both architectures.

All credits should go to psaint of Zend Forums