Getting ZeroMQ working on a Mac looks like a pain if you try to compile, but there’s a much easier way to get it up and running, with just a few brew and PECL commands.

I’ve been wary of Homebrew for a while, as there were lots of issues with Macports in the past, but I’ve found it’s a lot easier than trying to compile various things yourself in OS X (I tried to compile 0MQ, which took a while and ended up broken anyway)


Install Homebrew and ZeroMQ

Grab a copy of Homebrew then run the following command

brew install zeromq

Then once this is installed, install the PECL extension for PHP

Enable ZeroMQ support for PHP

sudo pear channel-discover
sudo pecl install


If you have more than one PHP binary on your computer (such as if you are using Zend Server on OS X, which means you will have the default PHP binary and the Zend PHP binary) then even if 0MQ looks like it is enabled using phpinfo() you may still get the following error from Composer:

– Installation request for react/zmq dev-master -> satisfiable by react/zmq[dev-master].
– react/zmq dev-master requires ext-zmq * -> the requested PHP extension zmq is missing from your system.

This is because Composer uses the PHP-CLI binary to both check and install things, meaning that unless it’s enabled for the binary it’s looking at, it won’t install, even if your web server has it enabled.

You just need to add (even temporarily) the correct PHP binary to the shell path:

export PATH=/usr/local/zend/bin:$PATH

(change depending on where your other binary is)

Then run composer.phar install again and it should work.

  • By: Andrew Kirkpatrick
  • In: PHP
  • Under: