exceptionz

Thoughts on Technology, Methodology and Programming.

Install RabbitMQ on Snow Leopard with Macports

Posted by Marcus Wyatt on 10 March 2010

Before we can start to install RabbitMQ, we need to update the MacPorts repository to use the latest RabbitMQ release:

Open /opt/local/etc/macports/sources.conf in text editor, and replace the ‘rsync://’ line with the following:

http://www.rabbitmq.com/releases/macports
rsync://rsync.macports.org/release/ports/ [default]

Now we can use the sync command to cause MacPorts to retrieve the package indices from the newly-added repository

sudo port sync

Before you install, it will be a good idea to check the available versions of RabbitMQ server by running ‘port search’.

Now, we can install:

sudo port install rabbitmq-server

All good so far, right.

Then the instructions tells you when you want to run the newly installed RabbitMQ server, all you need to do is execute:

sudo rabbitmq-server

Or you can enable the launchd startup item:

sudo launchctl load -w /Library/LaunchDaemons/org.macports.rabbitmq-server.plist

BUT, you get the following error when running ‘sudo rabbitmq-server’:


The error is caused because Erlang cannot find the rabbitmq libraries. The libraries should be installed into the same directory as the Erlang/OTP’s core libraries. The directory usually is ‘/opt/local/lib/rabbitmq/lib’ when you used MacPorts to install Erlang.

You can find out where the libraries is install by using the Erlang shell:

  1. Enter the Erlang console by executing ’erl’ in your shell
  2. Now execute ’code:get_path().’ to get the Erlang libraries path, you should see the following:

Next we need to find out where the RabbitMQ libraries are installed. Normally, with MacPorts install it should be ‘/opt/local/lib/rabbitmq/lib/rabbitmq_server-1.7.2’ (can be another version as well). But, if you used another install method, then you can just search the filesystem for ‘rabbit.beam’ to find the location.

Now, we need to symlink the rabbitmq_server library directory to the Erlang library directory.

cd /opt/local/lib/erlang/lib/
sudo ln -s /opt/local/lib/rabbitmq/lib/rabbitmq_server-1.7.2 rabbitmq_server-1.7.2

And you should be good to go. Now just start your RabbitMQ server with:

sudo rabbitmq-server

And check the server status with:

sudo rabbitmqctl status

You shouldn’t see any error output for the status call.

Status of node ‘rabbit@marcus-macbook’ …[{running_applications,[{rabbit,”RabbitMQ”,”1.7.2”},
{mnesia,”MNESIA CXC 138 12”,”4.4.12”},
{os_mon,”CPO CXC 138 46”,”2.2.4”},
{sasl,”SASL CXC 138 11”,”2.1.8”},
{stdlib,”ERTS CXC 138 10”,”1.16.4”},
{kernel,”ERTS CXC 138 10”,”2.13.4”}]},
{nodes,[‘rabbit@some-server’]},
{running_nodes,[‘rabbit@some-server’]}]
…done.

If you are having troubles with starting the server, try the following:

  • Make sure your ‘/etc/hosts’ file has an entry to ‘127.0.0.1’ pointing to your computer name. To locate your computer name just look in System Settings > Sharing and at the top you’ll see a box containing the computer name.
  • If you are still having issues, try deleting the mnesia database backing RabbitMQ. (When the server starts successfully it will create a new database.)

    sudo rm -rf /opt/local/var/lib/rabbitmq/mnesia/rabbit

Hopefully, peeps will find some of this helpful.

Later


5 Responses to “Install RabbitMQ on Snow Leopard with Macports”

  1. Mutaz said

    Hi
    I’ve tried to install Rabbit MQ for many times and every time I get the below dump!
    Any ideas please?

    Thank you

    {error_logger,{{2010,5,16},{18,11,40}},”Protocol: ~p: register error: ~p~n”,[“inet_tcp”,{{badmatch,{error,duplicate_name}},[{inet_tcp_dist,listen,1},{net_kernel,start_protos,4},{net_kernel,start_protos,3},{net_kernel,init_node,2},{net_kernel,init,1},{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}]}
    {error_logger,{{2010,5,16},{18,11,40}},crash_report,[[{initial_call,{net_kernel,init,[‘Argument__1’]}},{pid,},{registered_name,[]},{error_info,{exit,{error,badarg},[{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}},{ancestors,[net_sup,kernel_sup,]},{messages,[]},{links,[#Port,]},{dictionary,[{longnames,false}]},{trap_exit,true},{status,running},{heap_size,377},{stack_size,24},{reductions,509}],[]]}
    {error_logger,{{2010,5,16},{18,11,40}},supervisor_report,[{supervisor,{local,net_sup}},{errorContext,start_error},{reason,{‘EXIT’,nodistribution}},{offender,[{pid,undefined},{name,net_kernel},{mfa,{net_kernel,start_link,[[rabbit,shortnames]]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]}
    {error_logger,{{2010,5,16},{18,11,40}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,shutdown},{offender,[{pid,undefined},{name,net_sup},{mfa,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]}
    {error_logger,{{2010,5,16},{18,11,40}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]}
    {“Kernel pid terminated”,application_controller,”{application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}”}

    Crash dump was written to: erl_crash.dump
    Kernel pid terminated (application_controller) ({application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}})

  2. JOsH said

    $ sudo port install rabbitmq-server
    —> Computing dependencies for rabbitmq-serverError: Unable to execute port: invalid command name “supported_archs”
    Before reporting a bug, first run the command again with the -d flag to get complete output.

  3. […] Install RabbitMQ on Snow Leopard with MacPorts […]

  4. Rommel said

    I’ve experienced this error just a couple of days ago after installing RabbitMQ using MacPorts. I’m using Snow Leopard OS. I found out that it cannot connect to my localhost (i.e. rabbit@xxx, where xxx is the host name of my computer). So I added my host name in /private/etc/hosts file using the loopback ip 127.0.0.1. That worked for me.

    Also, if you are using launchctl to start rabbitmq-server, make sure that your rabbitmq-server libs are symlinked to erlang lib – check this link for details https://exceptionz.wordpress.com/2010/03/10/install-rabbitmq-on-snow-leopard-with-macports/

  5. seo tools said

    seo tools…

    […]Install RabbitMQ on Snow Leopard with Macports « exceptionz[…]…

Leave a comment