用brew在mac上安装amqp

gho*_*ika 9 php macos homebrew pecl amqp

我想amqp用我的mac sierra 安装pecl.

我用brew安装了php,pecl install amqp收到错误:checking for amqp using pkg-config... configure: error: librabbitmq not found

我安装了brew librabbitmq-c包,但我仍然遇到这个错误.我认为它不知道与pkg-config同步.

有人知道该怎么做吗?

小智 30

首先用brew安装rabbitmq-c:

brew search librabbitmq
No formula or cask found for "librabbitmq".
Closed pull requests:
Add rabbitmq-c (aka librabbitmq) formula (https://github.com/Homebrew/legacy-homebrew/pull/13437)


brew install rabbitmq-c
Run Code Online (Sandbox Code Playgroud)

然后用pecl安装amqp:

pecl install amqp
Run Code Online (Sandbox Code Playgroud)

设置librabbitmq的路径:

Set the path to librabbitmq install prefix [autodetect] : /usr/local/Cellar/rabbitmq-c/0.9.0
Run Code Online (Sandbox Code Playgroud)

验证是否已安装amqp:

php -i|grep amqp
Run Code Online (Sandbox Code Playgroud)

  • 在 Big Sur 上工作正常,只是地窖的路径发生了变化:/opt/homebrew/Cellar/rabbitmq-c/0.11.0 (3认同)

小智 8

感谢您的这次演练,非常有帮助。简单说明一下,在 Mac OS 12.0.1 Monterey 中,homebrew 中rabbitmq的默认安装路径是:

/opt/homebrew/Cellar/rabbitmq-c/0.11.0
Run Code Online (Sandbox Code Playgroud)

  • 实际上对我来说(Monterey 12.3.1)它是`/usr/local/Cellar/rabbitmq-c/0.11.0` (2认同)

gho*_*ika 1

Brew 不会将文件添加到 pkg-config 路径,因此需要一个命令: export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/Cellar/rabbitmq-c/0.9.0/lib/pkgconfig"