Installing rubygems 1.3.7 and jekyll on Ubuntu 10.04

seanh's Avatar


30 Sep, 2010 12:39 PM

Hey, I wonder if someone could help me through this, as I seem to be making a bigger and bigger mess.

You can't install Jekyll on Ubuntu 10.04, it complains that Liquid requires rubygems-1.3.7. I figured out that, although the package name is "rubygems-1.8" it is actually version 1.3.5. So you have to install rubygems from source. I downloaded and extracted rubygems-1.3.7 and did ruby setup.rb but this gave permissions errors, so (in the great tradition of Ubuntu users) I immediately did sudo ruby setup.rb. I found the binary it installed at /usr/bin/gem1.8.

This is where I seem to have gone wrong, I think things have been installed as root, and my normal user cannot get at them. Maybe some unfortunate combination of running as sudo and my umask. So for example, gem1.8 install jekyll (or in fact any gem1.8 command) will give an error about "no such file to load". But sudo gem1.8 install jekyll works just fine, except that it installs /usr/bin/jekyll with root permissions, such that only root can read and execute the file! I changed the perms of the file so that 'group' and 'other' can read and execute it, but then running it as non-root produces another "no such file to load" error. sudo jekyll works just fine. So now I have rubygems and jekyll installed on my system, but it looks like a lot of the files they've installed are owned by root and not readable by anyone else.

Try again. This time I wanted to install rubygems and jekyll in my homedir, and not as root. Following the instructions here:

I did:

$ mkdir ~/mygemrepository
$ mkdir ~/mystuff
$ export GEM_HOME=/home/mygemrepository 
$ ruby setup.rb --prefix=~/mystuff

RubyGems seemed to install into my homedir okay. I added GEM_HOME to my shell initialisation file, and added $HOME/mystuff/bin to my path. There is a gem1.8 binary in $HOME/mystuff/bin and which gem1.8 reports $HOME/mystuff/bin. It all looks good, but gem1.8 install jekyll still gives "no such file" errors:

$ gem1.8 install jekyll
/usr/local/lib/site_ruby/1.8/rubygems.rb:10:in `require': no such file to load -- rubygems/defaults (LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems.rb:10
from /home/seanh/mystuff/bin/gem1.8:8:in `require'
from /home/seanh/mystuff/bin/gem1.8:8

My guess is that some of those system-wide rubygems-1.3.7 files that I installed that are only readable by root are still getting involved. Maybe what I need is to completely clean rubygems and jekyll out of my system (somehow) and then follow the same steps as above for installing into my homedir not as root. I don't see any "uninstall" command in ruby setup.rb --help, so I guess it's a case of locating where all the installed rubygems and jekyll files on the system are and removing them manually.

  1. 1 Posted by seanh on 30 Sep, 2010 04:19 PM

    seanh's Avatar

    A few hours later I am able to answer my own question. I haven't figured out how to clean the bad rubygems and jekyll installs out of my system yet, but I've figured out how to install RubyGems and Jekyll on Ubuntu 10.04 using a fresh virtual machine. The answer is that it's easier to download and install the RubyGems 1.3.7 package from Ubuntu 10.10 than it is to install RubyGems 1.3.7 from source. Here's my how-to:

    Installing Jekyll on Ubuntu 10.04

    gem install jekyll will not work with the version of rubygems (1.3.5) that is packaged for Ubuntu 10.04.1, because Jekyll depends on Liquid which requires rubygems 1.3.7. So to install Jekyll on Ubuntu you have to somehow install RubyGems 1.3.7 first. Rather than installing RubyGems from source, the easiest thing to do is install the RubyGems package from the next release of Ubuntu (10.10), because that package is RubyGems version 1.3.7.

    First install all the Ruby packages that you'll need:

    $ sudo aptitude install ruby-full

    Next, download and install the rubygems1.8 package for the Maverick Meerkat (10.10) release of Ubuntu from <>. Here is the download page. Install the downloaded file by double-clicking on it or with a command like:

    $ sudo dpkg --install Downloads/rubygems1.8_1.3.7-2_all.deb

    You should now have RubyGems 1.3.7 installed:

    $ which gem
    $ gem -v

    Now, finally, you can install Jekyll:

    $ sudo gem install jekyll

    The final hurdle is to discover where RubyGems has put the Jekyll binary, because it's not on your path. The command jekyll won't do anything, and you won't find it with any of which jekyll, whereis jekyll or locate jekyll. gem list lists all of the RubyGems you have installed so that you can see that the jekyll gem and its dependencies are installed, and gem contents jekyll lists of all the installed files belonging to the jekyll gem. From the output of that last command you can find that the jekyll binary is at a ridiculous location, this command should run jekyll:

    $ /var/lib/gems/1.8/gems/jekyll-0.7.0/bin/jekyll

    You could alias that, or add it to your path.

  2. 2 Posted by seanh on 30 Sep, 2010 04:53 PM

    seanh's Avatar

    One other thing, some of the problems I had were caused by my umask, which causes files that I create to be readable by only me and not other users. When I was doing sudo gem install ... RubyGems was using this umask and installing files that could only be read by root. If you have a private umask like me (and it seems like the sensible thing to do, generally) you need to remember to temporarily make it more liberal when running installers like RubyGems:

    $ umask 022
    $ sudo gem install jekyll
    $ umask 077
  3. Support Staff 3 Posted by Eric Hodel on 30 Sep, 2010 06:17 PM

    Eric Hodel's Avatar

    Yes, I immediately suspected your umask from your first message. Glad you worked it all out.

  4. Eric Hodel closed this discussion on 30 Sep, 2010 06:17 PM.

  5. seanh re-opened this discussion on 01 Oct, 2010 04:19 PM

  6. 4 Posted by seanh on 01 Oct, 2010 04:19 PM

    seanh's Avatar

    Yeah, I think even my very first attempt when I did sudo ruby setup.rb to install RubyGems 1.3.7 from source and then sudo gem install jekyll to install Jekyll would have worked, if I had done umask 022 first. At some point I may try that on a fresh VM to verify that it works. Installing RubyGems from the future Ubuntu package may still be better though, because it can be easily uninstalled.

  7. Nick Quaranto closed this discussion on 03 Oct, 2010 05:13 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac