Herd does not ship with Xdebug out of the box, but you can manually install and compile the Xdebug PHP extension via Homebrew and pecl.
Here are the instructions:
First Install php via Homebrew:
brew install php
Next, pecl install Xdebug
pecl install xdebug
This creates an xdebug.so extension file that you can now activate and use with Laravel Herd.
On an M1/M2 Mac, the extension can be fount at /opt/homebrew/lib/php/pecl
. On an Intel Mac, it will be at /usr/local/lib/php/pecl
.
Finally, activate Xdebug
You may activate Xdebug by editing your php.ini file. This file is located at ~/Library/Application Support/Herd/config/php/<version>/php.ini
..
# Absolute path to the xdebug.so filezend_extension=/opt/homebrew/lib/php/pecl/20220829/xdebug.so # Enable Xdebugxdebug.mode=debug
Please read the official instructions for more information, and thanks to BeyondCode for this great app.
Filed in: