How To Install XDebug on MAMP (OSX)

Xdebug is debugger and profiler that will prettify your errors by printing out stack traces in case of errors or exceptions, with a timestamp showing the duration of each step of the stack. There are a lot of benefits to have it activated, even on a production server, even more on your development environment.

Here is how to install Xdebug on a MAMP installation.

First, locate your php.ini : you might be running PHP 5.6 or PHP 7.0.0, either way you’ll have to edit the right configuration files. Take a look at your phpini(), usually at


Be careful, the 8888 port may be different to you (use your usual localhost URL). Look for the “Loaded Configuration File” line. Mine is:


Capture d'écran 2016-02-22 10.09.32

Simply edit this file and look for the “[xdebug]” section, usually at the end of the file.

If you want to do it via your Terminal :

$ vim /Applications/MAMP/bin/php/php7.0.0/conf/php.ini

VIM Crash Course

Browse (Command Line Mode)

The editor has many modes: right after you’ve opened the file, you’re in browsing mode. You can navigate threw the file via the arrow keys… or :

H: Left
J: Down
K: Up
L: Down
G: Go to the bottom of the file
gg : Go to the top of the file
/text : Look for the next occurence of “text”,
n : go to the next occurence of the searched pattern
N : go to the previous occurence of the searched pattern

Edit (Insersion Mode)

When you’ve reach what you where looking for, press “i” to go to Insertion mode. Simply edit, copy, paste as a regular text editor.

Save and quit

When you’ve done your modifications, press ESC to go back to the command line mode :

:q : Quit the file without any modifications. You’ll be warned if there have been edits.
:q! : Force quit the file, even with modifications, without saving (override).
:w : Save the file
:wq : Save and quit the file. You’ll be back in the Terminal.

Capture d'écran 2016-02-22 10.21.57

When you’ve found the [xdebug] section, paste OR uncomment (remove the ; character) the following :


As before, the 8888 port might be different on your system. If you reach localhost via http://localhost/your_website, the port will be 80.
The zend_extension path is probably different as well but it should be already there in the php.ini file. Anyway if you can’t find [xdebug] section or the zend_extension line, go to the /Applications/MAMP/bin/php/php7.0.0/lib/php/extensions/ folder and find your own no-debug-no-zts-**** name of folder.

Finally, don’t forget to reboot the Apache service (reboot MAMP).

There you go, Xdebug is correctly installed on your MAMP’s php running version :

Capture d'écran 2016-02-22 10.33.02

xdebugged :

Capture d'écran 2016-02-22 10.29.21

One thought on “How To Install XDebug on MAMP (OSX)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

<span>%d</span> bloggers like this: