Running the gem doc server at startup on OS/X by jgn on Friday, June 18, 2010 in Technology and Ruby

I've been traveling a fair bit lately, and have occasionally had spotty Internet access. So my access to documentation for gems and whatnot has been limited.

It would be nice to have all of my gem documentation available locally. But I'm lazy. I don't want to be typing "gem server" all the time.

So here's what you do. Locate your appropriate gem command with "which gem"; I'm using rvm to run Ruby 1.9.1, so my answer is: /Users/jgn/.rvm/rubies/ruby-1.9.1-p376/bin/gem

Then create a gemserver.plist file like so, replacing the path to my gem with the path to yours:

[sourcecode language="xml"] Labellocalhost.gem.serverProgramArguments/Users/jgn/.rvm/rubies/ruby-1.9.1-p376/bin/gemserverRunAtLoad [/sourcecode]

Now copy to /Library/LaunchDaemons

The next type you reboot, you'll have your gem docs at http://localhost:8808/

comments powered by Disqus