Install error rb-appscript extconf.rb failed

1.2k Views Asked by At

Fairly new to this so I've been trying to awhile to figure this out but unable to locate an answer.

gem update --system

When installing the rb-appscript I get the following error.

gem install rb-appscript

Building native extensions. This could take a while...
ERROR: Error installing rb-appscript: ERROR: Failed to build gem native extension.

/Users/Dz/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20150719-5167-en4sxa.rb extconf.rb

extconf.rb failed
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/Dz/.rbenv/versions/2.2.2/bin/$(RUBY_BASE_NAME)
extconf.rb:44:in `': uninitialized constant Config (NameError)

extconf failed, exit code 1

Gem files will remain installed in /Users/Dz/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rb-appscript-0.6.1 for inspection.
Results logged to /Users/Dz/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/rb-appscript-0.6.1/gem_make.out

2

There are 2 best solutions below

0
On

First, I hope you're enjoying Ruby. :-)

The Config module was renamed and deprecated to RbConfig around Ruby 1.9 (not sure when exactly). Config was removed entirely in Ruby 2, hence the uninitialized constant Config fatal error.

If you'd happened to be using 1.9.x instead of 2.2.2, you would have seen a deprecation warning, which probably would have tipped you off.

(localhost) ~ ruby -e "puts Config::CONFIG['RUBY_PROGRAM_VERSION']"
-e:1: Use RbConfig instead of obsolete and deprecated Config.
1.9.3
(localhost) ~ ruby -e "puts RbConfig::CONFIG['RUBY_PROGRAM_VERSION']"
1.9.3
(localhost) ~ rbenv shell 2.2.3
(localhost) ~ ruby -e "puts Config::CONFIG['RUBY_PROGRAM_VERSION']"
-e:1:in `<main>': uninitialized constant Config (NameError)
(localhost) ~ ruby -e "puts RbConfig::CONFIG['RUBY_PROGRAM_VERSION']"
2.2.3

You could probably use Ruby 1.9 if you want to use rb-appscript, but I've never used that gem, so I can't speak to it specifically.

(You can easily install a version of 1.9 with rbenv and its ruby-build plugin.)

0
On

Are you on OSX? Make sure you installed/upgraded the latest XCode from the AppStore. Then run:

gcc -v

If that fails, you may have to accept the xcode license by running:

sudo gcc -v

and following the instructions.

Alternatively, you may install the XCode command line tools with:

xcode-select --install

Then re-run:

gem install gem_name