As you can see, some applications in Debian/Ubuntu tend to be very old, with Ruby we generally prefer to avoid system packages. There are some very robust Ruby managers like RVM (recommended for beginners) and rbenv which create an isolated Ruby installation in your home directory, so you have everything up-to-date and under control.
However, if you only wish to use Jekyll, packaged version of Ruby will work for you too, you can just install the latest version of Jekyll through RubyGems with a complementary gem
command (part of the ruby
package).
First you will need development files for Ruby (ruby-dev
package) as some Jekyll's dependencies require compilation. Additionally, the latest Jekyll version requires some JavaScript interpreter (e.g. nodejs
):
sudo apt-get install ruby-dev nodejs
Now you have two options. You can install Jekyll globally or locally in your home directory.
The global installation is easier since you don't need to configure pretty much anything. Just uninstall the jekyll
package and install the jekyll
gem with sudo:
sudo apt-get remove jekyll
sudo gem install jekyll
This will install Ruby dependencies into /var/lib/gems/1.9.1
and jekyll
executable into /usr/local/bin/jekyll
. Then just verify the version of Jekyll by running:
jekyll --version
Global installation may seem scary, but it won't cause any problems, especially if you just need Jekyll and don't do any heavy Ruby development.
The local installation in your home directory can be done in a few ways, here I will place jekyll
executable into ~/bin
directory – which should be automatically added into your $PATH
.
gem install --user-install --bindir ~/bin jekyll
With --user-install
option, gems will be installed into ~/.gem/ruby/1.9.1
/
--bindir
tells where the executable should go. If ~/bin
doesn't exist yet, gem may complain:
WARNING: You don't have /home/<user>/bin in your PATH,
gem executables will not run.
You may just need to reload your terminal or logout.
You can also add these options to the .gemrc
file, so they are always used when running gem
:
gem: --user-install --bindir ~/bin
Note that if you want to use additional plugins for Jekyll and/or wish to use Jekyll for GitHub pages, you should also consider using Bundler to manage your dependencies, as described in this GitHub article.