Skip to content

Instantly share code, notes, and snippets.

@toddsiegel
Last active July 14, 2017 18:01
Show Gist options
  • Save toddsiegel/5eaf04bc0a02914926f509ce2197b99c to your computer and use it in GitHub Desktop.
Save toddsiegel/5eaf04bc0a02914926f509ce2197b99c to your computer and use it in GitHub Desktop.
Setting up a sane Rails development environment on Mint Linux

Installing rebenv

Mint comes with a ruby package installed. It is installed as the root user and is not the latest version. We want the flexibility to install the latest version, to be able to easily upgrade and not have the hassles of installing gems as root.

To do this we need to use Ruby environment manager. This allows everyone on your team to be on the same version of Ruby, regardless of OS. This can be locked in with a .ruby-version in the root directory of your project.

I recommend rbenv to do this.

Dependencies

The software we're installing needs a few dependencies installed in order to work.

$ sudo apt install -y build-essential libssl-dev libreadline-dev zlib1g-dev libmysqlclient-dev

Set up rbenv

Make sure you install rbenv, according to the instructions. Read carefully, there is a note for Ubuntu Linux, which pertains to Mint too, that you need to follow.

You also need to install the ruby-build plugin for rbenv.

Once rbenv is installed and verified, according to their instructions, you can install ruby.

$ rbenv install 2.4.1

This will install the current, latest version of Ruby.

It's probably a good idea to run rbenv global 2.4.1. This will make your default ruby the latest version.

Install Rails

Installing Rails is pretty easy. This will install the current, lastest version.

$ gem install rails

Generate a new app

The rails new command is used to generate a new Rails app. The command below will generate a new app according to our needs. Replace <app-name-here> with the name of your app. :-)

rails new <app-name-here> -d mysql --skip-test --skip-turbolinks

Next add rspec-ralls for testing.

Using your favorite editor ;-) add the following to the :test group of your Gemfile (toward the bottom)

gem 'rspec-rails`

Install it as follows

$ bundle

You should be good to go!

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