installing amqp on mac with brew
Asked Answered
N

8

29

I wanted to install amqp with pecl for my mac sierra.

I installed php with brew, with pecl install amqp I receive an error: checking for amqp using pkg-config... configure: error: librabbitmq not found

I installed with brew the librabbitmq-c package but I still get this error. I think it's somehow not synced with the pkg-config.

Does someone have an idea what to do here?

Neom answered 13/8, 2018 at 8:51 Comment(0)
H
96

First install rabbitmq-c with brew:

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

Then install amqp with pecl:

pecl install amqp

Set the path to librabbitmq:

Set the path to librabbitmq install prefix [autodetect] : /usr/local/Cellar/rabbitmq-c/0.9.0

Verify that amqp is now installed:

php -i|grep amqp
Hyperboloid answered 16/10, 2018 at 9:35 Comment(5)
Although php -i | grep amqp didn't return any info confirming amqp was enabled, I was able to use it.Bogy
@dmd Maybe you forgot to add extension=amqp.so; to you php.ini file Pecl do it automatically but you must specify the location of your php.ini To set the location: pecl config-set php_ini /usr/local/etc/php/7.xxx/php.ini Check php.ini location file : php --iniHalftimbered
php -m | grep amqpIrremeable
@jose answer worked for me on MacOS Big Sur with PHP 7.2.Nigh
Works fine on Big Sur, just path to cellar has changed: /opt/homebrew/Cellar/rabbitmq-c/0.11.0Scant
M
8

Thanks for this walk through, it was super helpful. Just a quick note, in Mac OS 12.0.1 Monterey, the default install path for rabbitmq in homebrew is:

/opt/homebrew/Cellar/rabbitmq-c/0.11.0
Myrta answered 9/12, 2021 at 1:3 Comment(1)
Actually for me (Monterey 12.3.1) it is /usr/local/Cellar/rabbitmq-c/0.11.0Gloze
G
3

I'm on MacOS High Sierra. I installed the Command_line_Tools_macOS_10.13_for_Xcode_10.1.dmg from developer.apple.com and brew installed php 8.

For the amqp extension, I used:

brew install rabbitmq-c
pecl install amqp-1.11.0beta

at the prompt

Set the path to librabbitmq install prefix [autodetect] :

I entered:

Set the path to librabbitmq install prefix [autodetect] : /usr/local/Cellar/rabbitmq-c/0.11.0

Garin answered 20/10, 2021 at 22:20 Comment(1)
I also had to run mkdir -p /opt/homebrew/lib/php/peclSilkweed
L
2

The issue lies with pkg-config not being able to generate libs/cflags for librabbitmq.

$ pkg-config librabbitmq --cflags
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'openssl', required by 'librabbitmq', not found

What I did was to add both rabbitmq-c and openssl to $PKG_CONFIG_PATH as below:

export PKG_CONFIG_PATH="/usr/local/Cellar/rabbitmq-c/0.10.0/lib/pkgconfig:/usr/local/opt/[email protected]/lib/pkgconfig"

Then the build will succeed. (Note: I built mine with phpbrew rather than pecl, but should work).

Laurelaureano answered 14/4, 2020 at 13:34 Comment(0)
N
1

Brew doesn't add the file to the pkg-config path, so it needed a command: export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/Cellar/rabbitmq-c/0.9.0/lib/pkgconfig"

Neom answered 13/8, 2018 at 12:39 Comment(1)
didn't help though :-/Kashmir
S
0

It's a combination of question and both previous answers which worked for me.

First install RabbitMQ through brew as rabbitmq-c. Then with PECL but add the config path when asked: /usr/local/Cellar/rabbitmq-c/0.10.0

Needs to be adjusted with your installed brew version of RabbitMQ.

Scheelite answered 21/1, 2020 at 11:4 Comment(1)
This didn't work for me. pecl config-set php_ini /usr/local/etc/php/7.2/php.ini and brew install rabbitmq-c and pecl install amqp it still can't find amqp.soGand
S
0

Before installing make sure the taps are up-to-date:

brew update

Then, install RabbitMQ server with:

brew install rabbitmq

In case that directory is not in PATH it's recommended to append it:

export PATH=$PATH:/usr/local/sbin
Soniasonic answered 21/11, 2022 at 12:28 Comment(0)
A
0

On my M1 Mac Pro, PHP 8.2.1 the PECL install amqp rabbbitmq path it wanted is /opt/homebrew/Cellar/rabbitmq-c/0.11.0/

Hope this helps someone.

Atypical answered 22/2, 2023 at 10:23 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Chuu

© 2022 - 2025 — McMap. All rights reserved.