Regex Library Installation on OSX: Oniguruma

Picture of a ball of string

I’m running with Ruby 1.8.6 on Mac OSX 10.4.11 and normally that works well for me. However, I recently ran into a problem when I wanted to try out the highly attractive Ultraviolet syntax highlighter.

The command line invocation sudo gem install ultraviolet just choked horribly and spat out errors. Something was up with the Oniguruma regular expression library gem that Ultraviolet depends on and I needed to find out what, and, more importantly, what on earth the remedy was.

I googled, googled some more, and then decided to give up because the solutions that I found seemed either too complex or didn’t apply to my setup. I settled for Coderay instead, but my failure with Ultraviolet was bugging me.

Yesterday, I resumed the search for an answer to my Oniguruma conundrum. Good God almighty! An answer leapt from my Google search like an overeager salmon. The article that saved my sanity was this – thank you ‘Goodbye Helicopter’.

Anyway, in case there are others out there who are struggling to see the light with this problem, I figure that this information needs to be published as widely as possible, so here’s what to do.

  1. Download the Oniguruma ‘C’ code tarball from this site. I used version 5.9.1
  2. ‘cd’ to the directory that you downloaded the tarball into and expand it.
  3. ‘cd’ to the extracted directory, in my case onig-5.9.1
  4. Configure it with the command ./configure —prefix=/usr/local. The prefix path is where you would like to install the software. Change it to suit yourself if you need to.
  5. Issue the command sudo make
  6. Issue the command sudo make install

After this you should be able to install your Oniguruma-dependent gems with the greatest of ease. I hope these instructions work as well for you as they did for me.

Permalink | comments(View)

blog comments powered by Disqus