Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

installing amqp on mac with brew

Tags:

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?

like image 268
ghostika Avatar asked Aug 13 '18 08:08

ghostika


People also ask

How do I know if RabbitMQ is installed on my Mac?

For Linux/Unix/Mac: 0 you can use the RabbitMQ command line tool. You can also use the rabbitmq-diagnostics to check the server_version. It's a useful tool for diagnostics, health checks and monitoring. The command assumes that accessing your console requires sudo rights.


2 Answers

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 
like image 118
José Monagas Avatar answered Sep 19 '22 14:09

José Monagas


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).

like image 32
Flávio Heleno Avatar answered Sep 21 '22 14:09

Flávio Heleno