Archive

Archive for the ‘Ruby’ Category

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

April 16, 2012 1 comment

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 http://127.0.0.1:3000
  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/
Advertisements
Categories: Programming, Ruby