【问题标题】:Error with sudo gem install sqlite3 and gem install sqlite3sudo gem install sqlite3 和 gem install sqlite3 出错
【发布时间】:2014-11-17 00:27:12
【问题描述】:

“gem install sqlite3”出错

'错误:执行 gem 时 ... (Gem::FilePermissionError) 您没有 /Library/Ruby/Gems/2.0.0 目录的写入权限。'

'sudo gem install sqlite3' 时出现此错误

"生成 1 个警告。 编译异常.c 编译 sqlite3.c 编译语句.c 链接共享对象 sqlite3/sqlite3_native.bundle 叮当声:错误:未知参数:'-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future] clang:注意:这将是未来的硬错误(不能降级为警告) make: * [sqlite3_native.bundle] 错误 1

制作失败,退出代码 2

Gem 文件将继续安装在 /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.9 中以供检查。 结果记录到 /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/sqlite3-1.3.9/gem_make.out"

我已经安装了 RVM 并且还使用了 'sudo' gem install sqlite3 和 gem install sqlite3 。我错过了什么?

谢谢!

【问题讨论】:

    标签: ruby-on-rails ruby sqlite


    【解决方案1】:

    您不应将 sudo 与 rvm 一起使用。但是,您的 rvm 默认 ruby​​ 可能是系统 ruby​​。

    使用 rvm 安装新的 ruby​​ 版本:

    rvm install 2.1.1
    

    安装完成后,做一个 rvm 列表以确保它已安装:

    rvm list
    

    您将获得已安装红宝石的列表。

    rvm rubies
    
       ruby-2.0.0-p247 [ x86_64 ]
       ruby-2.1.1 [ x86_64 ]
    
    # => - current
    # =* - current && default
    #  * - default
    

    请注意,它将显示一个列表。如果尚未选择,则需要选择刚刚安装的那个:

     rvm use 2.1.1
    

    然后,再次运行 rvm list,您应该会看到如下内容:

    rvm rubies
    
       ruby-2.0.0-p247 [ x86_64 ]
    =* ruby-2.1.1 [ x86_64 ]
    
    # => - current
    # =* - current && default
    #  * - default
    

    注意区别,以及我现在如何选择本地 2.1.1 ruby​​。现在可以安全运行了

    gem install sqlite3
    

    【讨论】:

      猜你喜欢
      • 2017-01-16
      • 2021-05-01
      • 2012-09-09
      • 1970-01-01
      • 2011-01-08
      • 2012-10-13
      • 2011-08-26
      相关资源
      最近更新 更多