Herd for macOS

Documentation

Xdebug

#
Using Xdebug with Herd

Herd does not ship with Xdebug out of the box yet, but you can manually install and compile the Xdebug PHP extension via Homebrew and pecl.

#
Installing Xdebug

If you already manually installed Xdebug before switching to Herd, you may skip this step and activate the extension immediately.

Installing additional extensions such as Xdebug requires you to install PHP via Homebrew in order to compile the extensions.

You can do this by running:

brew install php

Once PHP is installed via Homebrew, you may install the Xdebug extension:

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.

#
Activating 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 file
zend_extension=/opt/homebrew/lib/php/pecl/20220829/xdebug.so
 
# Enable Xdebug
xdebug.mode=debug

For more information about the available Xdebug settings, please refer to the official Xdebug documentation.

#
Acknowledgements

We understand that installing the extension via Homebrew and having an unused PHP installation in your system is against the idea of Herd, but we're working on a better integrated solution later this year.