Following this article that installs xdebug on PHP7.3 with homebrew, and troubleshooting some problems I had.


Install xdebug via pecl.

PHP is available from the unofficial Mac OS X package manager Homebrew. Homebrew recommends using PECL to install Xdebug, so please follow the instructions above for installing via PECL.

Xdebug: Documentation

Check out pecl had been installed on your machine.

  $ which pecl

Next, install xdebug

  $ pecl install xdebug

But I have the first problem:

  ...
  Build process completed successfully
  Installing '/usr/local/Cellar/php/7.3.4/pecl/xxxxx/xdebug.so'

  Warning: mkdir(): File exists in System.php on line 294

  Warning: mkdir(): File exists in ↵
  /usr/local/Cellar/php/7.3.4/share/php/pear/System.php on line 294
  ERROR: failed to mkdir /usr/local/Cellar/php/7.3.4/pecl/xxxxx
  ....

Navigate to /usr/local/Cellar/php/7.x.x/ removing the symlink and install it again, recreate a new symlink.

Configure the ini

Navigate to /usr/local/etc/php/7.3/

  $ vi php.ini

Enabling xdebug extension, notice the path

  ;XDebug
  zend_extension="/usr/local/Cellar/php/7.3.4_1/pecl/20180731/xdebug.so"
  ;xdebug.remote_autostart=1
  xdebug.remote_port=9000
  xdebug.remote_enable=1
  ;xdebug.profiler_enable=1
  ;xdebug.profiler_output_dir="/Users/yishlai/xdebugtmp/"

For your customize, you can add what you need parameters.

If you want to adjust your memory limit, navigate to /usr/local/etc/php/7.3/conf.d/php-memory-limits.ini

And restart nginx, php, and services.

It should be work now if you want to integrate to PHPStorm you can reference the post:

Getting Xdebug working on php 7.2 and homebrew