How to setup XDebug for PHP7 on Mac?

Try:

brew install php71-xdebug

and if that doesn't work:

brew install --build-from-source php71-xdebug

Source: xdebug install on php70


First, make sure you're on the version of PHP for which you want Xdebug installed. It needs to be installed separately for each major version (7.0 vs 7.1 vs 7.2). You can check your version using php -v.

Then, run pecl install xdebug.

Once it's finished installing, you'll see a message like this:

Installing '/usr/local/Cellar/php/7.2.8/pecl/20170718/xdebug.so'

Then go to your php.ini (which you can find by running php --ini, and add these two lines to it:

zend_extension="/usr/local/Cellar/php/7.2.8/pecl/20170718/xdebug.so"
xdebug.remote_enable=on

Obviously, change the path to whatever was printed by the pecl xdebug installation.


It is available in Homebrew now as homebrew/php/php71-xdebug.