install and use xdebug with Laravel Herd

Ever since the release of Laravel Herd it has become my simple setup for having PHP locally available on my Mac. This has been super helpful as I do not need to run my docker containers locally as we all know docker on Mac doesn’t rock like how it does on Linux.

Laravel Herd has released support for xdebug recently but its a shame that is is only available for users with PRO subscriptions, but fortunately, it is not that difficult to install and enable xdebug on Laravel Herd PHP.

to install xdebug, we need pecl on the machine, which requires PHP. to have that up and running quickly install php via homebrew

$ brew install php

once that is out of the way, you can quickly install xdebug with pecl which is now available after installing php.

pecl install xdebug

once this command spit out all the output, the location of xdebug extension will be printed out. you should look at the output for something like this

now all you have to do is to add this following two lines to your php.ini config shipped with your Laravel Herd.

// make sure the line below is replaced with the correct value of your xdebug installation path!

the php.ini for your php version should live under ~/Library/Application\ Support/Herd/config/php/{phpversion}/php.ini

That’s pretty much it, doing a simple php -v should give you the confirmation that Xdebug is available!

Leave a Reply