Xdebug and docker4drupal on mac

To have xdebug working, you need to have this in your docker config for PHP.

      PHP_XDEBUG: 1
      PHP_XDEBUG_REMOTE_HOST: # macOS, Docker < 18.03

Also it is often noted that this should also be run

sudo ifconfig lo0 alias

So if your debuger is listening on 9000 port, this should work.


Sometimes path mapping window opens automatically but under some other windows and you don't see it, check all your spaces around that it is not hidden.

Check config of PHPSTORM by going in to PHP->Servers part, there are your mappings, check that they are ok.