Beesbot

RBEnv, Ubuntu and Bundler

Feb 10, 2013

A how-to for setting up ubuntu 18 for ruby on rails development

Install dependencies

sudo apt install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev

There is a new installer, run this

curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash

Then setup your shell

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc

Then use rbenv to install a version of ruby and set it as global

rbenv install 2.6.0
rbenv global 2.6.0

Now this should show you the ruby version

ruby -v

The step other howto's forget; you want to develop in rails right? Then you'll want to install rails in global gems

gem install rails

Alias Goodness

I've been really enjoying these commands to shortcut using bundler exec before everything add these to your ~/.bashrc

alias b="bundle"
alias bi="b install --path vendor"
alias bu="b update"
alias be="b exec"

Older Rubies

If you are installing older versions of ruby on a modern linux like ubuntu 18, you're going to run into GCC compiling issues with errors like ubuntu ruby 2.3.3 moifier ignored since 'D'. This happens because the modern linux uses GCC 7. So lets deal with gcc compatibility issues so we can build older versions of ruby.

sudo apt-get install gcc-6 g++-6 g++-6-multilib gfortran-6

Then install your older ruby like this

CC=/usr/bin/gcc-6 rbenv install 2.3.3

And you're all set

Read more on rbenv and bundler