Search code examples
rubyruby-debug

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


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


Solution

  • 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