in Code Snippet

Enable and disable Xdebug quickly on OS X homebrew php 7.1

Xdebug is a powerful tool for debugging PHP code, but it can be a memory hog when it is continually turned on. Xdebug can be quickly enabled and disabled by creating simple custom scripts.

Download these shell files on your Mac, make them executable and you are good to go!

curl -L https://gist.githubusercontent.com/Nikschavan/0222875b8ca913d19a10773c40764ca6/raw/8aecb01f11d12c58afdeb6a77505d780b8cd8313/disable-xdebug.sh -o /usr/local/bin/disable-xdebug
curl -L https://gist.githubusercontent.com/Nikschavan/0222875b8ca913d19a10773c40764ca6/raw/8aecb01f11d12c58afdeb6a77505d780b8cd8313/enable-xdebug.sh -o /usr/local/bin/enable-xdebug
chmod +x /usr/local/bin/*able-xdebug

Now run enable-xdebug on your terminal to enable Xdebug and disable-xdebug to disable it.

Leave a Reply

  1. Thanks, that’s a much cleaner approach than what others suggest (remove/rename xdebug.ini file or run CLI with -n flag)