Install Ruby on Rails for Dynamic Web Development [Mac OS X]
$ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
$ brew install git
ลง Homebrew ก่อน เพื่อใช้ Homebrew ลง Git
แต่สามารถโหลด Git มาลงโดยตรงเลยก็ได้ที่ http://www.git-scm.com
** อย่าลืมลง Xcode Developer Tools ก่อนนะครับ
ลง RVM (Ruby Version Machine)
$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
ทำให้ shell รู้จักคำสั่ง rvm โดย
$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bash_profile
$ . ~/.bash_profile
ลง Ruby 1.9.3 แล้วเลือกใช้ Ruby 1.9.3 เป็น Default Version
$ rvm install 1.9.3
$ rvm use 1.9.3
$ rvm --default use 1.9.3
จากนั้นก็ลง Rails ผ่าน gem
$ gem install rails
เรียบร้อยแล้วครับ
สำหรับฐานข้อมูลที่จะใช้เนี่ย ผมคิดว่าน่าจะใช้ sqlite3 ที่ติดมากับ Developer Tools ได้เลยนะ
ลง SQLite3 จาก gem
$ sudo gem install sqlite3 -v '1.3.6'
ส่วนใครอยากจะใช้ MySQL หรือ PostgreSQL ก็เชิญอ่านต่อเลยครับ ...
ลง MySQL ผ่าน Homebrew แล้วให้ gem ชี้ไปหา MySQL ที่ลงเวอร์ชั่นล่าสุด
$ brew install mysql
** for Rails 3.0
$ gem 'mysql2', '~> 0.2.7'
** for Rails 3.2 or later
$ gem 'mysql2'
ลง PostgreSQL
$ brew install postgresql
$ gem 'pg'
ข้อมูลจากที่นี่นะครับ ...
http://ryanbigg.com/2011/06/mac-os-x-ruby-rvm-rails-and-you/
ใครเจอปัญหา Segmentation Fault ตอน bundle install
อ่านนี่นะครับ http://www.macbaszii.com/2012/06/solving-segmentation-fault-problem-on.html
Ruby on Rails Textmate Bundle Supported Rails2 and Rails3
https://github.com/drnic/ruby-on-rails-tmbundle


Comments
Post a Comment