Can't install xdebug on Mac with Homebrew

2019-03-09 07:56发布

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.

8条回答
Rolldiameter
2楼-- · 2019-03-09 08:03

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

查看更多
放我归山
3楼-- · 2019-03-09 08:03

This is my solution! Try it! ;)

1 Install developer tools:

xcode-select --install

2 Instal Autoconf. This is a tool for producing shell scripts that automatically configure software

brew install autoconf

3 If you use PHP >5.6

sudo pecl install xdebug

Have fun ;)

查看更多
女痞
4楼-- · 2019-03-09 08:03

It looks like the repo moved, but it is available here, complete with instructions on how to access it from Homebrew.

查看更多
该账号已被封号
5楼-- · 2019-03-09 08:07

If you get this error after adding the tap and installing:

$ brew install "josegonzalez/php/php55"
==> Installing php55 from josegonzalez/php
Error: Formulae found in multiple taps: 
 * homebrew/php/php53
 * josegonzalez/php/php53

Please use the fully-qualified name e.g. homebrew/php/php53 to refer the formula.

it is because josegonzalez/php has been moved to homebrew-php/php recently, so you will face the previous error.

The idea is pretty simple, remove the old deprecated repo josegonzalez/php

brew untap josegonzalez/php
brew tap --repair
brew update

See the source of this solution to fix any other related bugs.

查看更多
ゆ 、 Hurt°
6楼-- · 2019-03-09 08:09

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

Summary:

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

Full example:

# update homebrew
brew update

# install a version of php, e.g. 7.0
brew install php@7.0

# now they tell you how to link it, in my case
echo 'export PATH="/usr/local/opt/php@7.0/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php@7.0/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/php@7.0/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/php@7.0/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.

查看更多
乱世女痞
7楼-- · 2019-03-09 08:10

I'd found this page while googling how to install for php 7.1 on , and I've decided to leave here my solution:

brew install homebrew/php/php71-xdebug

Maybe it'll be helpful for someone else in future...

查看更多
登录 后发表回答