Using MacPorts To Install Ruby 1.9.1 and Rails 2.3.0 RC1
WARNING: If you want to live on the edge, please continue with the steps below. Also, please be aware that all gems are not fully compatible with
Ruby 1.9.1 stable release (i.e. 1.9.1p0). Furthermore, this installation requires you to remove ALL Ruby related gems and ports because
we are performing a clean install. Lastly, I am using an experimental machine (i.e. Apple PowerMac G5) to complete this task and I would
NOT advise the below actions within a production environment.
- Remove Previous Ruby Ports (i.e. ruby, ruby19, rb-*, and so on) and Gems
a) Ports
sudo port uninstall
sudo port clean
Note: Execute the above for all ruby related ports.
b) Gems
rm -rf /opt/local/lib/ruby
rm -rf /opt/local/lib/ruby19
Note: You may not need to execute both commands and this really depends on what you have installed and how.
- Remove Rake ( Optional If It Does Not Exist )
sudo rm -rf /opt/local/bin/rake
- Install Ruby 1.9.1, SQLite3, and Mysql 5 Ports
sudo port install ruby19 +nosuffix
sudo port mysql5 +server
sudo port sqlite3
Note: The above ruby19 install generates the required executables without the extension.
- Install Rack, Rake, and Rails 2.3.0 Ruby Gems
sudo gem install rack
sudo gem install rake
sudo gem install rails --source=http://gems.rubyonrails.org
- Install SQLite 3 Ruby Gem
sudo gem install sqlite3-ruby
- Install MySQL 2.8.1 Ruby Gem
sudo gem install kwatch-mysql-ruby – --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
- Install Thin
sudo gem install thin
- Generate Rails Test Application
rails test
- Change To The Root Of Rails Application
cd test
- Start Thin
script/server thin
Note: The above command produces the above warning message:
warning: encoding option is ignored - N
- Navigate To The Site Using Your Browser:
Result: You should see the “Rails Welcome aboard” page.
- Now, Let Us Generate A Simple Blog
script/generate scaffold blog title:string text:text
Note: The above command produces the above warning message:
warning: encoding option is ignored - N
- Migrate The Database
rake db:migrate
- Navigate To The Site Using Your Browser:
URL: http://localhost:3000/blogs
and interact with the Rails application to verify that things are working.
- If you made it this far,
you are running Rails 2.3.0 RC1 and Ruby 1.9.1.
Good luck,
-Conrad