Thoughts on Technology, Methodology and Programming.

Archive for the ‘Uncategorized’ Category

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:

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”}]},

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

  • Make sure your ‘/etc/hosts’ file has an entry to ‘’ 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.


Posted in Uncategorized | Tagged: , , | 5 Comments »

Gems, gems, and more gems…

Posted by Marcus Wyatt on 20 February 2010

I’ve been working frantically at gemifying some plugins. I can’t unfortunately lay claim to have written these gems, but I needed to use them as gems with the new bundler system. So I created or forked the projects on github and used jeweler to gemify them

  • pgexplain – The Rails gem shows the output, in your application logs, of applying “Explain” or “Explain Analyze” to the select queries of your rails application using PostgreSQL.
  • railsonpg – This is timesaver for middle/large Rails application which use PostgreSQL as database. Create/drop Views, Functions, Triggers, Foreign keys in your migrations using ruby syntax.
  • swffu – swffu (pronounced “swif-fu”, bonus joke for french speakers) uses SWFObject 2.2 to embed swf objects in HTML and supports all its options. SWFObject 2 is such a nice library that Adobe now uses it as the official way to embed swf! SWFObject’s project can be found at http://code.google.com/p/swfobject swffu has been tested with rails v2.0 up to v3.0b and has decent test coverage so rake test:plugins should reveal any incompatibility. Comments and pull requests welcome: http://github.com/marcandre/swffu

The swffu plugin to gem conversion was the most work. Since the plugin used install.rb and uninstall.rb to add/remove some assets (javascripts, etc) to the rails application structure. I had to rethink how this functionality would be achieved. I decided to use rake tasks to accomplish the same functionality. The only trick is to add the require ‘swffu/tasks’ to the Rakefile.

So enjoy these new gems!

Posted in Uncategorized | Tagged: , , | Leave a Comment »

My bash history

Posted by Marcus Wyatt on 24 April 2009

Inspired by Ben Maybey and his bash history summary, here is mine:

Read the rest of this entry »

Posted in Uncategorized | Leave a Comment »