I finally got to walking through a great gentle introductory ALA article on Ruby on Rails. I wanted to run rails Demo to build my first project, but I got nastiness:
$ rails -v
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:379:in `report_activate_error': RubyGem version error: rake(0.7.3 not >= 0.8.3) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:311:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:337:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:336:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:336:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:65:in `active_gem_with_options'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:50:in `gem'
from /usr/bin/rails:18
That’s not especially welcoming. Let’s see if MacPorts can come to the rescue.
After installing MacPorts, this got me going:
sudo port selfupdate sudo port install rb-rubygems sudo gem install rails
I saw this from the gem install rails:
Successfully installed rake-0.8.3 Successfully installed activesupport-2.2.2 Successfully installed activerecord-2.2.2 Successfully installed actionpack-2.2.2 Successfully installed actionmailer-2.2.2 Successfully installed activeresource-2.2.2 Successfully installed rails-2.2.2 7 gems installed Installing ri documentation for rake-0.8.3... Installing ri documentation for activesupport-2.2.2... Installing ri documentation for activerecord-2.2.2... Installing ri documentation for actionpack-2.2.2... Installing ri documentation for actionmailer-2.2.2... Installing ri documentation for activeresource-2.2.2... Installing RDoc documentation for rake-0.8.3... Installing RDoc documentation for activesupport-2.2.2... Installing RDoc documentation for activerecord-2.2.2... Installing RDoc documentation for actionpack-2.2.2... Installing RDoc documentation for actionmailer-2.2.2... Installing RDoc documentation for activeresource-2.2.2...
I had some issues because my PATH included /usr/bin before /opt/local/bin (so MacOS’s old gem binary got picked up before MacPorts’ version). You can tell you’re running the correct version:
$ which gem /opt/local/bin/gem $ gem -v 1.3.1
If you see version 1.0.1, you’re still need to follow these instructions to install MacPorts. Add something like this to your ~/.bashrc or ~/.profile:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
Anyway, looks like things are good now. Yea new toys.
Related posts:
- Switching between Rails 2 and Rails 3 on Mac OS X or Ubuntu with RVM
I’m migrating AdGrok to Rails 3 this weekend–what with the new ActiveRecord query functionality, and MongoMapper, and all our gems migrating to Rails 3, it seems like it’s time. The...... - HOWTO: Fix Ruby on Rails 2.3.x textarea Value Truncation
Turns out that Rails versions 2.3.6 through 2.3.8 have a pretty horrid parameter-parsing bug, and I’m surprised there hasn’t been more hoopla about it. If you have a textarea form...... - Creating acts_as_… gems for Rails 3.1.x
There are a lot of posts on how to build rubygems. With Rails 3.1, though, they’re all old and busted. The new hotness is built right into rails now. Just...... - HOWTO: Wrangle the pg (postgresql) gem with macports and rvm
Seeing this? Installing pg (0.11.0) with native extensions /Users/mrm/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) /Users/mrm/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb checking for pg_config... no No pg_config.........