The fast copy-paste way
sudo sh -c 'echo zend_extension=$(find /usr/lib/php/extensions -name "xdebug.so") >> $(php -qr "echo php_ini_loaded_file();") && apachectl restart'
This command do the following :
- Finds the native Xdebug extension that comes with Xcode
- Asks php which config file is loaded
- Adds the Xdebug extension path in the config file
- Restarts apache.
Compatible with Sierra, El Capitan & Yosemite with the bundeled apache, but untested with MAMP & XAMPP.
Before launching the command, make sure Xcode command line tools are installed : xcode-select --install