Installing Rails & sqlite3 on Mac OS X Leopard
Assuming you are running the latest Mac OS X Leopard, these are the steps I took to get Rails running and my Gems in a place where I wouldn’t have to be constantly using the sudo command.
First off, Leopard comes prepackage with ruby 1.8.6 installed:
neil-mcgeehans-macbook-pro:~ neilmcgeehan$ ruby --version ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
Next, take a look at http://ozmm.org/posts/local_gems.html for setting up Gems in your home dir.
Open up ~/.bash_profile and insert this:
alias gemi='gem install --no-rdoc --no-ri -y' export GEM_HOME="$HOME/.gems" export GEM_PATH="$GEM_HOME" export PATH="$HOME/.gems/bin:$PATH"
Feel free to use the gemi command when you don’t want the docs that come with whatever Gem you are installing.
Once you are done updating your bash_profile, just run:
source ~/.bash_profile
This will reload the .bash_profile
Then take a look at you local Gems:
gem list --local
There shouldn’t be any listed, thats a good thing. You are now putting your Gems in your home directory, and won’t have to use sudo all the time.
Time to install rails:
gem install rails
Perfect, now you should have Rails 2.2.2 installed. Create a new rails skeleton, and start up the server:
rails mynewapp cd mynewapp script/server
Load up localhost:3000 in your web browser and you should be up and running. Kill the server with control-C.
But what is a new app without a database. Rails uses sqlite by default. To get this installed properly you will need Apple’s xcode. This can be found on your Mac OS X install DVD. Find the xcode folder and install xtools. If you don’t have that DVD, I think you can find the install files on Apple’s website. Once that is done, you are ready to install sqlite.
gem install sqlite3-ruby
Now you should have Rails 2.2.2 installed, along with sqlite3, take a look:
gem list --local
You are now on your way with Rails and Ruby Gems.
Look for my next post about getting Git installed and working with github.com to store your repositories.
Please dont let this blog die! I am new to rails as well and learning with you would be pretty cool.
@Digg User #4747
I hope it doesn’t die, because that would mean I’ve stopped learning Rails. BTW, how did you find this blog? I just put it up a few days ago, with only one post!
Thanks for this post — very useful for me upgrading from my Rails 1.2.6 included on Leopard to 2.2.2. I found you by Googling mac os x rails 2 — you were first page, probably because of all those occurences of ‘Rails’ in your title, tags and body!