0

I've just installed Ruby 1.9.3-p374 into rbenv and am bundling for an application I am working on. However, when the bundle gets to binding_of_caller I see the following error:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
extconf.rb:7: uninitialized constant RUBY_ENGINE (NameError)

running echo $RUBY_ENGINE gives me a blank string. Manually setting RUBY_ENGINE to ruby doesn't help either.

How can I get round this problem?

Neil Middleton
  • 22,105
  • 18
  • 80
  • 134
  • are you using a non-login shell? maybe shell hooks from `rbenv init` are not getting executed. – dnozay Feb 19 '14 at 21:56

2 Answers2

2

RUBY_ENGINE and RUBY_VERSION are both constance defined by ruby for a running ruby program. They are not environment variables available on a plain shell which explains why your echo command comes back empty handed.

Also, as evidenced by the stacktrace excerpt, you are not using Ruby 1.9.3 but the default Ruby 1.8 on a Mac. As on Ruby 1.8, RUBY_ENGINE is not available, you get the error you observe.

And the cause of all of this is probably simply that you haven't switched ti actually use your rbenv installed ruby. For that, you should try something like rbenv global 1.9.3-p374 on your shell and check that your current ruby is the right one (by checking e.g. ruby --version).

Holger Just
  • 52,918
  • 14
  • 115
  • 123
0

Just check whether it is defined first. Something like this

if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'