Skip to main content

How to install Jekyll on Arch Linux

Summary

Jekyll on Arch Linux - Beginner friendly guide on how to install Jekyll - the static site generator that transforms plain text into static websites and blogs - on Arch Linux using the Bash shell, RubyGems and Bundler.

Introduction #

This Jekyll (the static site generator that transforms plain text into static websites and blogs) installation guide for Arch Linux will walk you through getting the necessary prerequisites, configuring RubyGems, and setting up Bundler for managing Ruby application dependencies. It also covers best practices for managing gem installations, configuring Bundler, and getting a new or existing Jekyll website up and running.

Installing prerequisites #

Make sure you are using the latest packages before installing anything new. Use the Arch Linux package manager pacman to update your system before you start:

sudo pacman -Syu

Afterwards use pacman again to install the ruby and base-devel packages:

pacman -S ruby base-devel

Configure RubyGems #

RubyGems is a package manager for Ruby modules (called gems), somewhat comparable to what pacman is to Arch Linux. It can be installed with the rubygems package, which is a dependency of ruby.

By default in Arch Linux, when running gem, gems are installed per-user (into ~/.local/share/gem/ruby/), instead of system-wide (into /usr/lib/ruby/gems/).

As of Version 3.0 of ruby, the installation path of gems changed from $HOME/.gem/ruby/ to $HOME/.local/share/gem/ruby/.

This is considered the best way to manage gems on Arch, because otherwise they might interfere with gems installed by Pacman.

The recommended way to setup that is by manually specifying your $GEM_HOME, which then can be appended to your $PATH environment variable in order to allow RubyGems binaries to be executed. Add the following to your ~/.profile or ~/.bash_profile file:

export GEM_HOME="$(gem env ~/.local/share/gem/ruby/)"
export PATH="$PATH:$GEM_HOME/bin"

To apply the $GEM_HOME variable, re-login or run source ~/.profile or source ~/.bash_profile.

Installing Gems #

When it comes to installing gems, , there are at least the following three ways to install gems on Arch Linux:

Bundler was designed to prevent Ruby projects from relying on and being disrupted by gem updates, provided that you specify the gem versions in a project’s Gemfile.

Using Bundler is the preferred way to manage gems for most people, also on Arch Linux.

Configure Bundler #

If you want to install the bundle locally, it’s advisable to first execute bundle config --local path .bundle (or specify a different path of your choice instead of .bundle).

Bundler used to prompt users to set up a local configuration when installing as a user, but unfortunately it no longer does this for some reason.

bundle config --local path .bundle

Add the path of you local bundle, e.g. .bundle, to the list of excludes in _config.yml. If you are using git, consider adding the local bundle to your .gitignore file.

New Jekyll Website #

If you do not have a Jekyll project yet, install Jekyll and Bundler, the manager for Ruby application dependencies and gem versions, with gem:

gem install bundler jekyll

To start a new project with Jekyll, just create one by running:

jekyll new my-awesome-site

and then cd (change directory) into the new project:

cd my-awesome-site

Even without any content existing there for the time being, you can review the bare project at http://localhost:4000 when running jekyll serve or bundle exec jekyll serve.

Existing Jekyll Website #

If you have an existing project, install Bundler with gem:

gem install bundler

I assume you have a Gemfile in place, which contains all your dependencies, e.g. gem "jekyll". To install all the gems you need, use Bundler by running the following command:

bundle install

Afterwards run either jekyll serve or bundle exec jekyll serve. You should be able to see the project at http://localhost:4000.

Useful commands #

View the current RubyGems environment:

gem env

See what gems are installed:

gem list

Get information about a gem:

gem spec GEM_NAME

Replace GEM_NAME with the actual name of the gem.


Further readings #

Sources and recommended, further resources on the topic:

Author

Jonas Jared Jacek • J15k

Jonas Jared Jacek (J15k)

Jonas works as project manager, web designer, and web developer since 2001. On top of that, he is a Linux system administrator with a broad interest in things related to programming, architecture, and design. See: https://www.j15k.com/

License

License: How to install Jekyll on Arch Linux by Jonas Jared Jacek is licensed under CC BY-SA 4.0.

This license requires that reusers give credit to the creator. It allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only. To give credit, provide a link back to the original source, the author, and the license e.g. like this:

<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://www.ditig.com/instructions/how-to-install-jekyll-in-arch-linux">How to install Jekyll on Arch Linux</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://www.j15k.com/">Jonas Jared Jacek</a> is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="license noopener noreferrer">CC BY-SA 4.0</a>.</p>

For more information see the DITig legal page.


“Make errors impossible. Making it impossible for the user to make errors is the best way to eliminate error messages.”

Alan Cooper , Software designer and programmerAbout Face, - IT quotes