3

Cannot load ruby-debug on a Mac OS X 10.7.3 Lion.

Not sure why the path is incorrect.

Ruby version is 1.8.7 which came standard with Lion.

Installed Xcode

Developer Information:

  Version:  No version information available
  Location: /Applications/Xcode.app
  Applications:
  Xcode:    4.3 (1175)
  Instruments:  4.3 (4321)
  SDKs:
  Mac OS X:
  10.6: (10K549)
  10.7: (11D50a)
  iPhone OS:
  5.0:  (9A334)
  iPhone Simulator:
  5.0:  (9A334)


$ sudo gem install ruby-debug -v 0.10.4
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-debug:
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/linecache-0.46 for     inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/linecache-0.46/ext/gem_make.out


$ 

Looking for the ruby.h path on the Lion system, the path's are different.

./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/Headers/ruby.h
./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/ruby.h
./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/Headers/ruby.h
./Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0/ruby.h

What is the best approach from this point?

thanks,

pb

phil
  • 193
  • 2
  • 12

3 Answers3

4

Solution: Xcode 4.3 needs to be installed and then from Xcode Preferences-General the Xcode Command Line Tools must be installed.

Without the Command Line Tools the above errors are generated.

Once installed, Ruby-Debug loads.

$ sudo gem install ruby-debug -v 0.10.4
Password:
Building native extensions.  This could take a while...
Building native extensions.  This could take a while...
Successfully installed linecache-0.46
Successfully installed ruby-debug-base-0.10.4
Successfully installed ruby-debug-0.10.4
3 gems installed
Installing ri documentation for linecache-0.46...
Installing ri documentation for ruby-debug-base-0.10.4...
Installing ri documentation for ruby-debug-0.10.4...
Installing RDoc documentation for linecache-0.46...
Installing RDoc documentation for ruby-debug-base-0.10.4...
Installing RDoc documentation for ruby-debug-0.10.4...
$ rdebug -v
ruby-debug 0.10.4
phil
  • 193
  • 2
  • 12
0

I faced same problem while trying to install rails on my Lion. This is how i could solve it.

Install rvm

$ curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable

Install osx-gcc-installer

https://github.com/kennethreitz/osx-gcc-installer

Installed new version of ruby

rvm install 1.9.3

Typed to following command to show the requirements

rvm requirements

To use an RVM installed Ruby as default, instead of the system ruby:

rvm system ; rvm gemset export system.gems ; rvm 1.9.3 ; rvm gemset import system.gems # migrate your gems rvm alias create default 1.9.3

Installed rails:

sudo gem install rails

My Mac is now read for rails!! YAY!!

diham
  • 233
  • 2
  • 5
0

In all likelihood, you will (and in all actuality, should) install Ruby via RVM, located here. Once you havee done that you will need to install your Rubies like so

rvm install ruby-1.9.2-p290 --with-gcc=clang

The important part is --with-gcc-clang, which tells the system to use clang. From there your gems should install for the version of Ruby you specified in the install command.

igreulich
  • 149
  • 9
  • Why is the base ruby and gem which comes with Lion failing to install ruby-debug? I have ruby 1.8.7 base 249 working fine with ruby-debug (0.10.3) under os x 10.6.8. I understand what you are suggesting, just confused why I can not rebuild my production environment with debug? – phil Feb 28 '12 at 10:11
  • Do you regularly install gem with sudo? – igreulich Feb 28 '12 at 17:16
  • In production yes, but in development no, i put the gems in ~home/usr. What do you recommend? – phil Feb 28 '12 at 21:37
  • This is the command run from my home directory, where I have a ./usr directory structure. The same path issue occurs. – phil Feb 28 '12 at 21:44
  • $ gem install ruby-debug -v 0.10.3 -i ./usr Building native extensions. This could take a while... ERROR: Error installing ruby-debug: 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 /Users/pblen/usr/gems/linecache-0.46 for inspection. Results logged to /Users/pblen/usr/gems/linecache-0.46/ext/gem_make.out $ – phil Feb 28 '12 at 21:45
  • rvm is installed and i plan on learning it. i see definite benefits. thanks for pointing me in a new direction. – phil Feb 29 '12 at 15:38
  • rvm, coupled with gemsets (and bundler) makes maintaining differing requirements/rubies/gems quite easy. – igreulich Feb 29 '12 at 21:02