【问题标题】:error bundle install postgresql: `mktmpdir': parent directory is world writable but not sticky错误 bundle install postgresql: `mktmpdir': 父目录是世界可写但不粘
【发布时间】:2015-05-28 06:15:32
【问题描述】:

我试图用数据库 postgresql 安装 rails 并得到一个错误:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb 
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
        --with-pg
        --without-pg
        --enable-windows-cross
        --disable-windows-cross
        --with-pg-config
        --without-pg-config
        --with-pg_config
        --without-pg_config
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:92:in `mktmpdir': parent directory is world writable but not sticky (ArgumentError)
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:510:in `try_link0'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:534:in `try_link'
        from extconf.rb:36:in `<main>'


Gem files will remain installed in /tmp/bundler20150325-70824-ipx8vh/pg-0.18.1/gems/pg-0.18.1 for inspection.
Results logged to /tmp/bundler20150325-70824-ipx8vh/pg-0.18.1/gems/pg-0.18.1/ext/gem_make.out
An error occurred while installing pg (0.18.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.

可以做些什么来解决这个问题?

【问题讨论】:

  • 该消息部分显示“由于某种原因,可能缺少必要的库和/或标头,无法创建 Makefile。请查看 mkmf.log 文件以获取更多详细信息。”您可能应该检查该文件。确保您安装了 postgresql 库(可能还有 postgresql-dev 库)。如果它们位于非标准位置,则需要通过各种 --with-opt-* 选项指定位置。

标签: ruby-on-rails postgresql gem


【解决方案1】:

查看此链接:stackoverflow.com/questions/9668753

这总是对我有用,但我也先下载 postgres 并移至 Applications 目录: Postgress.app

安装 Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

如果您不确定是否运行 Homebrew:

brew -v 

如果已安装,您应该获得当前版本,例如 Hombrew 0.9.5

然后运行:

brew install postgresql

终于:

bundle install

【讨论】:

    【解决方案2】:

    谢谢,但我有解决方案,问题是 32 位与 64 位兼容性。

    ARCHFLAGS='-arch x86_64' gem install pg
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-30
      • 2014-06-04
      • 1970-01-01
      • 2013-05-13
      • 1970-01-01
      相关资源
      最近更新 更多