Friday, June 17, 2011

Making ZeroMQ jar for Mac

Making ZeroMQ jar for Mac was one of the most painful tasks I have done. And here is my attempt to save effort  of others for the same task.

Get latest version of zmq for POSIX systems from
Say the file you got is zeromq-2.1.7.tar.gz., place this in your home directory( not required, any directory is fine as an example I am taking home directory).
Unzip the file and you will get a directory zeromq-2.1.7
Then run following commands:
     1 cd ~/zeromq-2.1.7
     2 ./
     3 ./configure
     4 make
     5 sudo make install

Now before we proceed you should get pkg-config, if you already have, then ignore this step.
Get pkg-config from
Unzip this in home directory and pkg-config-0.22 will be created.
Run the following commands:
     1 cd ~/pkg-config-0.22
     2 ./configure --prefix=/usr/local/pkg-config-0.22 --datarootdir=/usr/share
     3 make
     4 sudo make install
     5 export PATH=$PATH:/usr/local/pkg-config-0.22/bin

Now download java jzmq from and place it in folder ~/jzmq (not necessary, i am taking it for cake of example)
Run the following
     1 cd ~/jzmq
     2 export JAVA_HOME=`/usr/libexec/java_home`
     3 ./
     4 ./configure
     5 make
     6 sudo make install

This will make zmq.jar in /usr/local/share/java/

Problems you might face:
  While running ./
     * error: could not find pkg-config. pkg-config is required to run
        -- you should complete STEP 2
  While running ./configure
     * ./configure: line 15180: syntax error near unexpected token `newline'
      ./configure: line 15180: ` PKG_CHECK_MODULES('
        --you missed STEP 2.2
    * configure: error: cannot link with -lzmq
        -- this happens when you forget to do STEP1.4,1.5
    * configure: error: the JAVA_HOME environment variable must be set to your JDK location
        -- repeat STEP 3.2


  1. Thanks for the post! You saved me some time.

  2. Thanks a million - great job.. Give me a Maven, Ant or Gradle build any day...

  3. Hi sudo apt-get install pkg-config worked for me... here is the google group lin k for the same!topic/storm-user/2e_WfJYAm18

    And thanks for the post