How to install jekyll?

On my 13.04 and 14.04 systems, things worked for me after installing the ruby-dev package, then running the gem install:

  • sudo apt-get install ruby1.9.1-dev (or try: ruby-dev instead)

  • gem install jekyll # if this fails then sudo gem install jekyll

After that, jekyll was installed correctly.

Note that for the gem install instruction, it is better not to use sudo.*****

It's better to use something like RVM, so that sudo isn't required. On some systems it may be necessary to use sudo, if for instance permissions were set by previous sudo commands or root-level configuration.

See this stackoverflow question -- how to install gems without sudo for more information and for help on getting permissions set to user instead of root.

***** Credit to @iguarav for this best practices advice as well as the link to rvm.io.


Guide for 14.04 LTS without RVM

Jekyll 3 needs ruby 2.0 or higher, so we first install ruby 2.0, it's development headers and nodejs:

sudo apt-get install -y ruby2.0 ruby2.0-dev nodejs

Then we point the commands included in the ruby package to the new version.

sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby2.0 10
sudo update-alternatives --install /usr/bin/gem gem /usr/bin/gem2.0 10
sudo update-alternatives --install /usr/bin/irb irb /usr/bin/irb2.0 10
sudo update-alternatives --install /usr/bin/rdoc rdoc /usr/bin/rdoc2.0 10
sudo update-alternatives --install /usr/bin/testrb testrb /usr/bin/testrb2.0 10
sudo update-alternatives --install /usr/bin/rake rake /usr/bin/rake2.0 10
sudo update-alternatives --install /usr/bin/erb erb /usr/bin/erb2.0 10
sudo update-alternatives --install /usr/bin/ri ri /usr/bin/ri2.0 10

And finally we use gem to install the jekyll gem.

sudo gem install jekyll