5. Installing the Asciidoctor Ruby Gem

Asciidoctor can be installed using the gem command, Bundler or a Linux package manager.

5.1. Install using gem

To install Asciidoctor using the gem command:

  1. Open a terminal

  2. Type the following gem command

    $ gem install asciidoctor

If the Asciidoctor gem installed successfully, the asciidoctor command line interface (CLI) will be available on your PATH. To confirm that Asciidoctor is available, execute:

$ asciidoctor --version

The following output should appear in your terminal:

Asciidoctor 1.5.6.2 [https://asciidoctor.org]
Runtime Environment (ruby 2.3.0p0 [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:- ex:UTF-8)

5.2. Install using Bundler

To install Asciidoctor for a project using Bundler:

  1. Open your project’s Gemfile

  2. Add the asciidoctor gem using:

    gem 'asciidoctor'
  3. Save the Gemfile

  4. Open a terminal

  5. Install the gem using the bundle command:

    $ bundle

5.3. Install on Fedora

To install Asciidoctor on Fedora (or RHEL via EPEL) using the rubygem-asciidoctor package:

  1. Open a terminal

  2. Run the installation command on Fedora:

    $ sudo dnf install asciidoctor

The benefit of installing the gem using this method is that the package manager will also install Ruby and RubyGems if not already on your machine.

5.4. Install on Debian or Ubuntu

To install Asciidoctor on Debian or Ubuntu:

  1. Open a terminal

  2. Type the following apt-get command using sudo:

    $ sudo apt-get install asciidoctor

The benefit of installing the gem via apt-get is that the package manager will also install Ruby and RubyGems if not already on your machine.

5.5. Install on Alpine Linux

To install Asciidoctor on Alpine Linux using the asciidoctor package:

  1. Open a terminal

  2. Type the following apk command using sudo:

    $ sudo apk add asciidoctor

The benefit of installing the gem via apk is that the package manager will also install Ruby and RubyGems if not already on your machine.