2015-07-19 152 views
2

相當新的這一點,所以我一直在試圖找出這一點,但無法找到答案。安裝錯誤rb-appscript extconf.rb失敗

gem update --system 

安裝rb-appscript時出現以下錯誤。

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

+1

我有同樣的問題。我在另一個SO帖子中發現rb-appscript不再受支持。這也打印在頭[主頁上](http://appscript.sourceforge.net/rb-appscript/index.html) –

+0

感謝您的提升。我也看到了。 – Architek1

+1

這可能有用:https://rubygems.org/gems/rb-scpt/ – foo

回答

1

首先,我希望您會喜歡紅寶石。 :-)

Config模塊在Ruby 1.9(不確定)的時候重新命名爲RbConfigConfig在Ruby 2中完全刪除,因此uninitialized constant Config致命錯誤。

如果您碰巧使用了1.9.x而不是2.2.2,那麼您會看到一個棄用警告,這可能會讓您失望。

(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 

你也許可以使用Ruby 1.9,如果你想使用rb-appscript,但我從來沒有使用的寶石,所以我不能給它專門講話。

(您也可以輕鬆安裝版1.9與rbenv及其ruby-build插件。)

-1

你在OSX?確保你從AppStore安裝/升級了最新的XCode。然後運行:

gcc -v

如果失敗,你可以通過運行接受的Xcode許可證:

sudo gcc -v

,並按照指示。

或者,您可以用安裝XCode的命令行工具:

xcode-select --install

然後重新運行:

gem install gem_name