Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install xdebug on Mac with Homebrew

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.

like image 587
sehummel Avatar asked Oct 03 '12 15:10

sehummel


People also ask

How do I install an older version of Xdebug?

If you use pecl .. then you can use pecl install xdebug-2.9. 3 . For your apt-get you may try sudo apt-get install <package name>=<version> syntax, for example: sudo apt-get install xdebug=2.9.

Where is PHP INI Mac brew?

By default your PHP file (located in /usr/local/etc/php/7. */php. ini) is shared between command-line PHP and PHP-FPM.


2 Answers

// Working as of 2021

As homebrew removed the extra php repository containing a version with xdebug already installed, you have to install it manually.

Summary:

  1. brew install <php version> for php
  2. update your path
  3. pecl install xdebug for xdebug

Full example:

# update homebrew brew update  # install a version of php, e.g. 7.0 brew install [email protected]  # now they tell you how to link it, in my case echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.bash_profile  # reload the file with the updated path, so we can use pecl source ~/.bash_profile  # check that the path is to the correct php executable, # and pecl is available which pecl # returns: /usr/local/opt/[email protected]/bin/pecl  # install xdebug, see https://xdebug.org/docs/install#pecl pecl install xdebug  # check that everything worked php --version # should show a xdebug version # like:  with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans 

The pecl install xdebug step above ended with

Build process completed successfully Installing '/usr/local/Cellar/[email protected]/7.0.30/pecl/20151012/xdebug.so' install ok: channel://pecl.php.net/xdebug-2.6.0 Extension xdebug enabled in php.ini 

So I didn't even need to enable the xdebug.so in php.ini.



If you need a special version of xdebug (e.g. your IDE doesn't like the 3.x.x versions), you can install a specific version xdebug-$VERSION, e.g. pecl install xdebug-2.9.8. You can find them on the list of available versions (Thanks Bower)

like image 117
luckydonald Avatar answered Sep 21 '22 00:09

luckydonald


Add this repository: https://github.com/josegonzalez/homebrew-php#readme

Then use brew install php54-xdebug for PHP 5.4

Or brew install php53-xdebug for PHP 5.3

Or brew install php55-xdebug for PHP 5.5

like image 31
Germain Carré Avatar answered Sep 23 '22 00:09

Germain Carré