Installing Ruby on Rails on Leopard

I am completely new to Ruby on Rails, and programming in general, and
so I have what imagine are two pretty idiotic questions:

  1. I am trying to install all of the components I need to run RoR on
    OS X Leopard (following instructions at
    http://teabass.com/super-simple-ruby-on-rails-install-with-macports-for-leopard/#comment-1993).

I got up to the part where I type “sudo gem update” into Terminal, and
all was well, until I got this error:


Attempting remote update of rubynode
Building native extensions. This could take a while…
ERROR: While executing gem … (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby extconf.rb update
==================== ERROR =====================
Please set RUBY_SOURCE_DIR to the source path of ruby 1.8.6
(2007-09-23)!


Any thoughts on how to get past this?

  1. Before I hit the above snag, I accidentally selected “fastthread
    1.0.1 (mswin32)” instead of “fastthread 1.0.1 (ruby)”, during the gem
    update. How can I now install the correct version of fastthread? (not
    even sure what that is, but it seems important).

Many thanks.

On Dec 24, 2007 12:10 AM, David T [email protected] wrote:

I got up to the part where I type “sudo gem update” into Terminal, and
all was well, until I got this error:

Run the following on a terminal:

gem env

to see current gem version. The latest version is 1.0.1. You have to
upgrade
the Ruby Gems before upgrading the gems on your machine. So, run: sudo
gem
update --system.

If it hangs then try:

sudo gem install rubygems-update
sudo update_rubygems

Any thoughts on how to get past this?

  1. Before I hit the above snag, I accidentally selected “fastthread
    1.0.1 (mswin32)” instead of “fastthread 1.0.1 (ruby)”, during the gem
    update. How can I now install the correct version of fastthread? (not
    even sure what that is, but it seems important).

Just do sudo gem uninstall fastthread and then do sudo gem install
fastthread.
If I were you, I would follow Hivelogic article on installing the Rails
stack.


http://www.rubyplus.org/
Free Ruby Screencasts

Thanks! Now a follow-up question:

I ran:

sudo gem update --system

It updated me to 1.0.1. Do I now have to reinstall gems like
capistrano and rails?

Unfortunately the Hivelogic article only applies to Tiger – it hasn’t
been updated yet for Leopard.

Figured it out:

gem list --local

Shows me the list of gems installed.

Oy vey, to be a newbie.

I tried running a test app, using the following procedure, and got the
following error.

sudo mkdir -p /usr/local/src
sudo chgrp admin /usr/local/src
sudo chmod -R 775 /usr/local/src
cd /usr/local/src

rails testapp
cd testapp
script/server

Missing the Rails 2.0.2 gem. Please gem install -v=2.0.2 rails,
update your RAILS_GEM_VERSION setting in
config/environment.rb for the Rails version you do have installed,
or comment out RAILS_GEM_VERSION to use the latest
version installed.

The thing is, I’m pretty sure I do have Rails 2.0.2. installed,
because when I type

rails -v

I get this:

Rails 2.0.2

If I comment out RAILS_GEM_VERSION, I get the same error, just without
“2.0.2.”

Probably not a great idea to create your app under /usr/local. I would
recommend /var/www or ~/rails or something like that. You’ll find it
much easier to work with and you won’t constantly be battling the
system’s permissions settings.

Thanks for the tip.

I ultimately resolved the problems above by getting rid of my macport-
installed versions, and using the ruby and rails included with
Leopard.

You can upgrade the gems, sudo gem update. If there is later versions
available, u will get the latest version. Then u can do sudo gem
cleanup to uninstall the older versions

Sent from my iPhone

Check the rails version in environment.rb file

Sent from my iPhone

David,

Here is a page you probably want to bookmark for the latest on Ruby on
Rails on Mac OS X:
http://ruby.macosforge.org/

And especially take a look at the FAQ here:
http://trac.macosforge.org/projects/ruby/wiki/FAQ

Sorry I didn’t see this sooner. It could have saved you a lot of
headaches.

David,

Oh also take a closer look at the gem command. There are some pretty
cool things you can do with it like:

gem outdated => will list all the local installed gems that are have
new versions available

Then it’s just a matter of running:
sudo gem install some_gem

The versions of RubyGems > 0.9.5 even take care of the dependencies
for you by default.

Another quick tip is that when Rails gets updated you should probably
install that gem first then a lot of the dependencies of Rails with
also get installed and should shorten the list of gems listed with
‘gem outdated’

Just some thoughts. Good luck.

P.S. I’ve been impressed with the support of Rails from Apple so far.
There was a problem some had before RubyGems 0.9.5+ was released, but
now that problem no longer exists. There shouldn’t be any reason not
to use the Apple installed gems and Ruby at this point.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs