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:
-
Open a terminal
-
Type the following
gemcommand$ 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:
-
Open your project’s Gemfile
-
Add the
asciidoctorgem using:gem 'asciidoctor'
-
Save the Gemfile
-
Open a terminal
-
Install the gem using the
bundlecommand:$ bundle
5.3. Install on Fedora
To install Asciidoctor on Fedora (or RHEL via EPEL) using the rubygem-asciidoctor package:
-
Open a terminal
-
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:
-
Open a terminal
-
Type the following
apt-getcommand 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:
-
Open a terminal
-
Type the following
apkcommand 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.