CodeHax: Code to Deploy – Part one. Installing Homebrew, Ruby, Git & Sublime

I just recently taught an intro to Ruby on Rails class and the hardest part was not explaining data types or object oriented programming but how to install everything you need to begin with. If you are using a Mac, the good and bad news is it already has Ruby installed.

While you can play around with Ruby out of the box, if you want to do something more serious with it such as Rails, you will need to install the latest version & tell your computer to use that path rather than the one already on your system.

But before we even get there, using a package manager to download, maintain and easily install/uninstall other programs is also super helpful. For this, we are going to use Homebrew.

Step 1: Find the Terminal
First, you need to find your terminal (also known as a command prompt or command Line interface CLI).

Step 2: Install Homebrew

# Type this into your terminal. You will notice that we are actually using Ruby to install Homebrew.
ruby -e "$(curl -fsSL"

view raw
hosted with ❤ by GitHub

You will probably get a prompt asking you if you will install xCode. Its a large file and there are ways to not install it but Homebrew depends on xCode so just install it.

Step 3: Install Ruby

# First type this into your terminal. *You must already have homebrew installed
brew install ruby
# After installing ruby, we need to edit the path on your computer so it uses
# the new installation of ruby and not the one packaged with your computer.
# Type the following into your terminal to edit the paths with VIM
sudo vi /etc/paths
# It will ask for your password (the one you used to login / install programs)
# Just type it in and press enter *You will not see anything but you are entering something I promise.
# This is what you will probably see
# We need to edit the paths to look like this:
/usr/local/bin # This is where your brew installed programs are
/usr/bin # This is where the system version of Ruby is
# Once you have made these changes, you need to hit ESC, then :w (write) to save the file
# Once saved, you can type :q (quit) to exit the text editor

Step 4: Install Git

brew install git # This will install the latest version of Git into your Homebrew Cellar

Step 5: Checking Git and Ruby installations

# Into your temrminal type
which ruby # This will give you the path to where ruby is installed if installed
ruby -v # This will give you the version of ruby you currently have installed
# You can check just about any other program in the same fashion
which git
git -v

view raw
hosted with ❤ by GitHub

Step 6: Install Sublime Text
Pretty straight forward. Sublime is a text editor. This where we will edit code.
go to here and download it.

Part 2 will cover scaffolding a basic CRUD function application in Rails as well as Postgresql.