Home > Programming, Ruby > Installing Ruby On Rails, MySql on Mac Os X 10.7 Lion

Installing Ruby On Rails, MySql on Mac Os X 10.7 Lion

This is the step i created from others website with few changes.
The Mac Os X Lion already included with ruby 1.8.7. in this Step we will install 1.9.3-p125.

  1. Install XCode 4.3 from App Store
  2. Install Command Line Tools from XCode Preferences
  3. Install HomeBrew
    bash-3.2# mkdir -p /usr/local/Cellar
    bash-3.2# /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
  4. Install RVM
    bash-3.2# bash -s master < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
  5. Install Ruby 1.9.3-p125
    bash-3.2# rvm install 1.9.3-p125
    bash-3.2# rvm use ruby-1.9.3-p125
    bash-3.2# rvm alias create default ruby-1.9.3-p125
  6. Install Rails and other stuff
    bash-3.2# gem install rails bundler rspec cucumber mysql2
  7. Install Git (Opt)
    bash-3.2# brew install git
  8. Install MySQL
  9. Set Variable Environment (you can also insert it in .bash_profile)
    Konoha:~ sasuke$ export PATH="$PATH:/usr/local/mysql/bin
    Konoha:~ sasuke$ export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
  10. Create Project
    Konoha:Ruby sasuke$ rails new Test01 -d mysql
    Konoha:Ruby sasuke$ cd Test01
    Konoha:Ruby sasuke$ rails generate model test name:string
  11. Prepare Database for project
    Konoha:Ruby sasuke$ mysql -u root -p
    mysql> create database Test01;
  12. Change Database configuration
    Konoha:Test01 sasuke$ vim config/database.yml
  13. Migrate Database
    Konoha:Test01 sasuke$ rake db:migrate
  14. Testing Project
    Konoha:Test01 sasuke$ rails server
  15. Open browser
  16. Continue Writing code

Reference :

  1. http://www.frederico-araujo.com/2011/07/30/installing-rails-on-os-x-lion-with-homebrew-rvm-and-mysql/
  2. http://astonj.com/tech/how-to-install-mysql-on-lion-mac-os-x/
Categories: Programming, Ruby
  1. Abz
    June 4, 2012 at 6:12 am

    For step 3. I was getting permission denied

    I had to use sudo, so my command looked like:-
    bash-3.2# sudo mkdir -p /usr/local/Cellar
    It asked me for my password – but it worked, so one step closer.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: