sajad torkamani

Setup prerequisites

Make sure you have the XCode command line tools:

xcode-select --install

Make sure you have PHP installed via Homebrew:

brew install php

Install Xdebug as a PECL extension

pecl install xdebug

Verify installation was successful

Running php -v should show something like:

PHP 8.1.6 (cli) (built: May 12 2022 23:30:39) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.6, Copyright (c) Zend Technologies
    with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans
    with Zend OPcache v8.1.6, Copyright (c), by Zend Technologie

Notice the with Xdebug line. Running pecl list should also show debug.