gem install error sqlite3 -v 1.3.9

时间:2014-08-22 03:09:48

标签: ruby-on-rails ruby sqlite

我遇到了安装sqlite3 -v 1.3.9的问题并尝试了来自不同线程的多个解决方案。我尝试的最后一个实际上将警告改为无效,所以现在我看不到完整的错误消息。这是我的设置:

Mac = OS X 10.9.3 
ruby = 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]
xcode = 5.1.1
xcode command line tools = 5.1.1

来自bundle install的原始错误消息:

Errno::EACCES: Permission denied @ rb_sysopen - /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9/.gemtest

来自gem install sqlite3 -v 1.3.9的错误消息:

ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_sysopen - /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9/.gemtest
user-MacBook-Pro:first_app user$ sudo gem install sqlite3 1.3.9
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3:
    ERROR: Failed to build gem native extension.

    /Users/user/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
checking for sqlite3.h... *** 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/user/.rvm/rubies/ruby-2.1.1/bin/ruby
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/lib
    --enable-local
    --disable-local
/Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
    from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:1120:in `block in find_header'
    from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
    from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
    from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:321:in `open'
    from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
    from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:321:in `open'
    from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
    from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
    from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:1119:in `find_header'
    from extconf.rb:35:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9 for inspection.
Results logged to /Users/connorphillips/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-12/2.1.0-static/sqlite3-1.3.9/gem_make.out
ERROR:  Could not find a valid gem '1.3.9' (>= 0) in any repository
然后我跑了

$ RCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install sqlite3

现在我的错误信息是:

ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_sysopen - /Users/connorphillips/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9/.gemtest

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

你确定你安装了sqlite吗?宝石只是一个包装。

使用brew:

brew install sqlite3

然后再次调用gem install命令。

消息似乎与开发工具有关。

You have to install development tools first.

那些已经安装好了吗?您可以使用过程详细信息here执行此操作。