I'm kind of new to using Homebrew, but I love it. It's so easy. I'm trying install Xdebug. Some of the posts on the web say to do this:
brew install xdebug
But it doesn't work. I get: Error, no available formula.
I did brew search xdebug
and it returned:
josegonzalez/php/php53-xdebug josegonzalez/php/php54-xdebug
I tried several different iterations of brew install
with this including brew install php53-xdebug
, but still no luck. Can someone help me? I can't find anything on Xdebug's site about using Homebrew, but yet posts on the web seem to indicate it's possible.
Forget about homebrew for a moment. I have tried doing with it and it is not a that good idea stability-wise. Instead stick to the default installation guide:
Installing XDebug on Mac OSX
Unpack the downloaded file with:
tar -xvzf xdebug-2.2.5.tgz
Run:
cd xdebug-2.2.5
Run phpize (install it via homebrew if you don't have it already)
phpize
As part of its output it should show (If it does not, you are using the wrong phpize):
Run:
./configure
Run:
make
Run:
cp modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20100525
Edit /etc/php.ini and add the line:
Restart the web server by typing in the terminal:
sudo apachectl restart
Use brew bundled pecl (when php installed with brew)
PHP 5.6 example
PHP 7.0 example (7.0 is now EOL and not by default in brew core)
PHP 7.1 example
PHP 7.2 example
PHP 7.3 does not work (yet) needs xdebug 2.7.0
or link
PHP 5.6 example
PHP 7.0 example
PHP 7.1 example
PHP 7.2 example
PHP 7.3 does not work (yet) needs xdebug 2.7.0
If php -v gives you an error stating xdebug.so could not be found (assuming the pecl install went well) then you could have "old" settings like php.ini Un-/reinstalling php with brew does not remove ini files. Upgrading php to the new format does not update ini files. Just reinstall php with brew after you removed the folder /usr/local/etc/php/5.6/ and xdebug should work.
The new brew php installation does not link. You could do that yourself if you would like to (brew link --force php@5.6) Als you could install brew-php-switcher to switch between versions.
Keep in mind if you loaded php as a service you have to restart the service.