Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save basti1302/6039716 to your computer and use it in GitHub Desktop.
Save basti1302/6039716 to your computer and use it in GitHub Desktop.

Step By Step Instructions for Installing Ruby, Cucumber & PhantomJS for Debian-based Systems (Ubuntu, Linux Mint, ...)

These instructions are intended for following a tutorial about Cucumber. The tutorial can be found here:

Before installing ruby, it might be a good idea to do

sudo apt-get update
sudo apt-get upgrade

You should also have git installed, if not sudo apt-get install git

Now, to install ruby, you have at least four options:

  • Install it directly with the OS' package manager,
  • install it from source,
  • install via RVM (ruby version manager) or
  • install via rbenv.

Both RVM and rbenv allow you to install multiple versions of ruby in parallel and easily switch between them. For rbenv, you can take a look at this nice gist.

Here, we simply install ruby directly: sudo apt-get install ruby

At the time of writing, this will install the debian package ruby1.9.1, which is ruby version 1.9.3p194. The cucumber examples should work with any 1.9 version. I have not tested them with ruby 2.0 yet. I recently updated the Gemfile.lock in the example project and tested it successfully with ruby 2.0.

You will also need the ruby-dev package, so if the above installed the package ruby1.9.1 you should also do sudo apt-get install ruby1.9.1-dev.

Now we will install the bundler gem. A gem is a packaged ruby application or library. It can be installed with the gem command that comes with ruby, like this: sudo gem install bundler. Bundler is a dependency manager which is built on top of the gems package system. So from now we will not install gems directly but let bundler do the work, which also automatically takes care of transitive dependencies.

Before we do that, we need to install a few more debian packages (which are prerequesites for the gems we will install with bundler - the bundle command will fail if they are not present): sudo apt-get install build-essential libxml2 libxml2-dev libxslt-dev.

Now, all ruby gems that are required to run Cucumber can be installed simply by typing bundle install in the top directory of the example project. If you have not done so yet, clone this repo right now by doing git clone -b 00_setup https://github.com/basti1302/audiobook-collection-manager-acceptance.git and cd to it. The file Gemfile contains the information which gems are to be installed.

bundle install will install cucumber with all its dependencies (and their transitive dependencies). Check that it's installed correctly with cucucmber --version (This tutorial uses 1.3.5).

Last but not the least we install PhantomJS. The package in the Ubuntu repository is quite old (1.6.0 at the time of writing) so go to http://phantomjs.org/download.html and fetch the tar.bz2, then do:

tar -xjf phantomjs-x.x.x-linux-x86_64.tar.bz2
sudo ln -s /path/to/phantomjs/bin/phantomjs /usr/local/bin/

Check that it is working with phantomjs --version (This tutorial uses 1.9.1).

@ineedlotzofrice
Copy link

I'm trying to install the debian packages on my macbook pro running 10.9.4 but i'm receiving an error.
I've edited the command so it reads
sudo brew install build-essential libxml2 libxml2-dev libxslt-dev

the error i get is as follows:

Error: No available formula for build-essential

Any one have any tips for me? thanks

@LaWizard
Copy link

SMH - I can't believe that no one else has noticed that the "cucucmber --version" command in this instruction is spelled incorrectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment