Nullcreations.net | Ramblings & Photography of Jerrett Taylor

Ruby shared-mime-info gem and OS X

February 18th, 2008 | 1 comment

For anyone doing stuff requiring a good MIME library in Ruby, shared-mime-info works well. On OS X a few things are necessary to make it work though.

First, use ports to install the shared-mime-info database:


sudo port install shared-mime-info

Then you have to set XDG_DATA_DIRS to point at the right place on OS X, which is /opt/local/share. Put this in your .bashrc file:


export XDG_DATA_DIRS=:/opt/local/share

XDG_DATA_DIRS is where freedesktop.org stuff looks to find files, and if not specified will look in /usr/share or /usr/local/share. Since ports on OS X puts everything in /opt/local, you have to set it.

That's pretty much it! If you don't install the shared-mime-info database and set the ENV variable the gem will still work, just not as well (returning text/plain instead of text/css for css files, etc.)

1 Comment

Posted by kabari 23 days ago.

thanks for this!

Musings

04.14.08

Trying to decide where to travel to? Wikitravel.org Random Page has the answers!

02.23.08

sd's embedded_actions has a new home on github

02.18.08

Very cool.

02.17.08

Open Source Food? - looks like a nice recipe site!

02.15.08

For anyone using capistrano with more than one target for deployment (staging, production), check out cap multistage

02.15.08

Wow, I just realized how bad my code blocks break my blog in safari. I should fix that!

01.27.08

Mike has created another nice netbeans theme - go check it out, if you use netbeans!

01.21.08

A handy tool, Rubular is a web based regex editor

01.15.08

Dan put together a sweet code editor plugin for mce with syntax highlighting etc.

12.13.07

On OSX? Add RubyImporter to Spotlight and search your source!

12.04.07

sd has released a new version of embedded_actions

11.27.07

RejectConf videos are online thanks to confreaks!

11.19.07

Good news - we upgraded a project at work to rails 2.0 rc2 and the speed to run specs dropped from 30-35 seconds to 10-15 seconds!

11.08.07

Eigenclass.org has a great big list of Ruby 1.9 changes that is being kept up to date!

11.06.07

Rein is working on a trac replacement in ruby called eskort , and it looks cool. More info on his goals