1.用brew下載xdebug.
brew
install php54-debug
2.在/etc/php.ini 中加入:
zend_extension="/usr/local/Cellar/php54-xdebug/2.2.5/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
3.重啓apache : sudo apachectl restart
4.在Netbeans中,偏好設置->php->debug,端口也爲9000。