Up And Running With Rails 3.1, RVM, Git And Homebrew
Pregame
Do you have the newest xcode? Have you reinstalled it since you upgraded to Lion? Go grab it from the Mac AppStore, it's free. Your going to need to have that installed before you can continue..
Some of you may need to install git still. Lets get you going with homebrew to make that nice and easy. Paste this into your terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
And Your installing homebrew. When it's done, open a new terminal tab and run:
brew install git
When this is done, open another terminal tab, and proceed to the main event.
Main Event
Let's make sure we start from the root directory. Copy and paste this command into your terminal:
cd
Now lets get rvm pulled down. Copy and paste this:
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
This should take a min. When it's done run these 3 commands:
touch ~/.bash_profile echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile source .bash_profile
Now rvm is on your machine and loaded into your current terminal window. Epic. Now it's time to install ruby 1.9.2. Copy/paste this:
rvm install 1.9.2
This will take a few minutes. Sit back. Relax. Have a homebrew. When it's done, we can clone your repo onto your computer or start a new one. Navigate to the directory you want to put the repo. I have a dir called Rails.. It's up to you. If your using an existing repo, you'll need to do something like this:
git clone git@github.com:jtmkrueger/atriplex_project.git
Unless your starting a new project. In that case, skip the last step and keep following along.
We'll use the atriplex example for the rest of this post.
Ok, now navigate into the directory:
cd atriplex_project
And run these 2 commands:
touch .rvmrc echo 'rvm 1.9.2@atriplex --create' > .rvmrc
Inserting the name you want for your gemset appropriately.
Great, now this might look a little strange. Back out of the directory:
cd ..
And then go back in:
cd atriplex_project
rvm should prompt you to approve your new gemset. Thats good. Say yes to everything. Now copy/paste these 2 things if your using the atriplex example:
gem install bundler bundle install
And if your starting a new repo, run these commands:
gem install rails
rails new proj_name
This should take a little to run but... That's it! If you used the atriplex example, now you can run:
rails s thin
And if you started a new project you'll be able to run:
rails s
Whenever your in this directory and everything will work like a charm.
Point your browser at:
http://localhost:3000
And you're off to the races!
