Skip to content

Instantly share code, notes, and snippets.

@apirak
Created March 16, 2012 02:03
Show Gist options
  • Save apirak/2048129 to your computer and use it in GitHub Desktop.
Save apirak/2048129 to your computer and use it in GitHub Desktop.
Install ruby and rails on OSX, Linux and Windows

Install Ruby and Rails

Ruby now come preinstalled on many Linux distributions, and Mac OS X includes Ruby). Try typing ruby -v at a command prompt--you may be pleasantly surprised.

If you don't already have Ruby on your system or if you'd like to upgrade to a newer version (remembering that this couse describes Ruby 1.9), you can install it pretty simply. What you do next depends on your operating system.

Install Ruby on Windows

  1. Download http://railsinstaller.org/ from Apple Application Store :

use this link : http://rubyforge.org/frs/download.php/75894/railsinstaller-2.1.0.exe

  1. Install railsinstaller :

double click on it to begin the installation

Watch the simple installation process and how to confirm that Ruby, Rails, Git, etc are all installed properly.

http://vimeo.com/34078037

Install Ruby on Linux

  1. First and foremost you need the C compiler and the Make utility. These are usually bundled together with some other tools and behind the scenes magic in a package called build-essential. So this is the first package that should be installed.

    $ sudo apt-get install build-essential

In addition, RVM will also need curl to download files. This is also a simple apt-get.

$ sudo apt-get install curl
  1. You're going to need a few libraries and their development package counterparts. Two of these libraries are readline, which lets you edit lines of text in bash or IRB, and zlib, which Rubygems will need to function. Also included is OpenSSL and LibXML.

    $ sudo apt-get install zlib1g-dev libreadline-dev libssl-dev libxml2-dev

  2. Now that you're all set up, install RVM itself. This is done via a shell script which you can download and run directly with a single command.

    $ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

Append the following line to your ~/.bashrc file.

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM

And then reload your bash environment (or close the terminal window and open a new one).

$ source ~/.bashrc
  1. In later version of RVM, an rvm requirements command was added to give you more information about the build and run requirements for various rubies. You can see and peruse this list of requirements by running rvm requirements.

    $ rvm requirements

  2. You'll probably want to install the MRI Ruby interpreter (the official Ruby interpreter, the one you're probably already familiar with). To do that (after you installed the build dependencies, see the previous steps), it's a simple rvm install 1.9.3. This will give you the MRI interpreter version 1.9.3 (the stable release at the time this article was written) at the latest patch level.

    $ rvm install 1.9.3 $ rvm --default 1.9.2 $ gem update $ gem install rails

Install Ruby on Mac

  1. Download Xcode from Apple Application Store :

use this link : http://itunes.apple.com/fr/app/xcode/id448457090?mt=12

  1. Install xcode :

Use finder => applications to locate "Xcode installation icon and double-click on it to begin the installation

  1. use a terminal to install git:

    $ gem install git

and put this line in your .bash_profile (create one if none exists) :

$ export PATH=$PATH:/usr/local/git/bin/
  1. use a terminal to install rvm:

    $ bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )

and run this command to update your .bash_profile :

$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
  1. use a terminal to install ruby 1.9.2 and rails:

    $ rvm install 1.9.2 $ rvm --default 1.9.2 $ gem update $ gem install rails

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