Can't get rails gem

Hi, I’m brand new to rails, and I have a mac 10.7 that I bought
today. I try the following:

joelrwesley$ sudo gem install rails
Password:
Building native extensions. This could take a while…
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/

ruby extconf.rb
mkmf.rb can’t find header files for ruby at /System/Library/Frameworks/
Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/
json-1.6.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.6.5/ext/json/ext/
parser/gem_make.out
joelrwesley$

Anybody have any ideas? Thanks, Joel

On Feb 26, 5:21am, Joel [email protected] wrote:

Hi, I’m brand new to rails, and I have a mac 10.7 that I bought
today. I try the following:

joelrwesley$ sudo gem install rails
Password:
Building native extensions. This could take a while…
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

Have you installed Xcode (or at the very least apple’s gve command
line tools package)?
You’ll need that when installing gems with native extensions.

Fred

Thanks Fred. I downloaded the latest Xcode last night, turned the
computer off for the night, and tried it again this morning. No go;
same message. I’m also supposed to be able to write gcc -v to test
the compiler from Xcode, but I’m getting an error on that also. I
tried going into Xcode and starting a project, and it seems to be
working. Xcode is now being distributed at the App store, instead of
off of the disk. I wonder if that has something to do with it? I’m
thinking of maybe trying to put it on my hard drive from the disk for
the old Leopard from my old machine.

As for Apple’s gve command line tools, package, I don’t know what that
is.

On Feb 26, 1:06am, Frederick C. [email protected]

On 26.02.2012, at 19:18, Joel wrote:

As for Apple’s gve command line tools, package, I don’t know what that
is.

:slight_smile: native mac os’ ruby 1.8 - too old to waste your time if you want to
practice in Rails.

Anyway this is your issue .

But today the only way to escape that insane stuff – to use rvm.

It’s pretty simple:

  1. Install latest Xcode
  2. Install rvm: http://beginrescueend.com/
  3. Install rubies you want to.
  4. Update gem --system
  5. Install Rails version you want.

Just easy and safe.

Thank you for the advice, Valery. I tried that, and (I believe)
followed the instructions at the rvm page. I say I believe, because
these instructions always seem to lead to a number of things that one
might reasonably try, though there’s no clear notion of what one
really should be doing… argh. anyway, I got to the last
instruction, which is to type rvm install 1.9.3, and I got the
following:

joelrwesley$ rvm install 1.9.3
Fetching yaml-0.1.4.tar.gz to /Users/joelrwesley/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/joelrwesley/.rvm/src
Configuring yaml in /Users/joelrwesley/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/joelrwesley/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/joelrwesley/.rvm/usr
Installing Ruby from source to: /Users/joelrwesley/.rvm/rubies/
ruby-1.9.3-p125, this may take a while depending on your cpu(s)…

ruby-1.9.3-p125 - #fetching
ruby-1.9.3-p125 - #extracted to /Users/joelrwesley/.rvm/src/ruby-1.9.3-
p125 (already extracted)
ruby-1.9.3-p125 - #configuring
Error running ’ ./configure --prefix=/Users/joelrwesley/.rvm/rubies/
ruby-1.9.3-p125 --enable-shared --disable-install-doc --with-libyaml –
with-opt-dir=/Users/joelrwesley/.rvm/usr ', please read /Users/
joelrwesley/.rvm/log/ruby-1.9.3-p125/configure.log
There has been an error while running configure. Halting the
installation.
joelrwesley$

So I went in and read the log. Here’s what it said:

joelrwesley$ emacs configure.log

[2012-02-26 11:39:47] ./configure --prefix=/Users/joelrwesley/.rvm/
rubies/ruby-1.9.3-p125 --enable-shared --disable-install-doc --with-
libyaml --with-opt-dir=/Users/j
oelrwesley/.rvm/usr
configure: WARNING: unrecognized options: --with-libyaml
checking build system type… i386-apple-darwin11.3.0
checking host system type… i386-apple-darwin11.3.0
checking target system type… i386-apple-darwin11.3.0
checking whether the C compiler works… no
configure: error: in /Users/joelrwesley/.rvm/src/ruby-1.9.3-p125': configure: error: C compiler cannot create executables Seeconfig.log’ for more details

So apparently my C compiler doesn’t work. Argh!

Thanks for any sympathy and advice,
Joel

If anyone has been following this and has the same problem, the
following tutorial was fantastic, and it fixed my problem:
http://code.google.com/p/git-osx-installer/downloads/detail?name=git-1.7.9.1-intel-universal-snow-leopard.dmg&can=3&q=

whoops, wrong site: try this: