Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby Gem安装pg工作,但bundle安装失败_Ruby_Macos_Postgresql_Ruby On Rails 4 - Fatal编程技术网

Ruby Gem安装pg工作,但bundle安装失败

Ruby Gem安装pg工作,但bundle安装失败,ruby,macos,postgresql,ruby-on-rails-4,Ruby,Macos,Postgresql,Ruby On Rails 4,关于这方面的话题很多,但我已经尝试了几乎所有的话题,但都没有成功 我在Mac OS X 10.9.4 Mavericks上,我有Postgres.app,它可以正常工作,sudo gem install pg也可以工作: Building native extensions. This could take a while... Successfully installed pg-0.17.1 invalid options: -f fivefish (invalid options are

关于这方面的话题很多,但我已经尝试了几乎所有的话题,但都没有成功

我在Mac OS X 10.9.4 Mavericks上,我有Postgres.app,它可以正常工作,
sudo gem install pg
也可以工作:

Building native extensions.  This could take a while...
Successfully installed pg-0.17.1
invalid options: -f fivefish
(invalid options are ignored)
Parsing documentation for pg-0.17.1
Done installing documentation for pg after 2 seconds
1 gem installed
但是当我尝试
捆绑安装时
我的错误与其他人的错误相同

  • 我已经尝试了
    bundle config build.pg——使用pg config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_-config
    然后
    bundle安装

  • 我有Xcode命令行工具

  • 哪个psql
    返回
    /Applications/Postgres.app/Contents/Versions/9.3/bin/psql

  • 哪些postgres
    返回
    /Applications/postgres.app/Contents/Versions/9.3/bin/postgres
以下是
捆绑包安装的错误:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
    checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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
    --with-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}/
    --with-pqlib
    --without-pqlib
    --with-libpqlib
    --without-libpqlib
    --with-ms/libpqlib
    --without-ms/libpqlib

extconf failed, exit code 1

Gem files will remain installed in /var/folders/07/my1cl5xj7g9cknnp3y2zg_rh0000gn/T/bundler20140723-29399-1o0uzqn/pg-0.17.1/gems/pg-0.17.1 for inspection.
Results logged to /var/folders/07/my1cl5xj7g9cknnp3y2zg_rh0000gn/T/bundler20140723-29399-1o0uzqn/pg-0.17.1/extensions/universal-darwin-13/2.0.0/pg-0.17.1/gem_make.out
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.

几天后,我终于找到了问题的根源(讽刺的是,当我决定放弃,继续前进时)

当我做一个
哪个捆绑包和
哪个gem
它们不是来自同一个ruby安装。
bundle来自rbenv,gem来自预安装的ruby on mac osx。

可能存在权限问题。可以使用:


sudo bundle安装--没有任何内容--路径供应商/缓存

您能更详细地介绍一下吗?我也有同样的问题-您采取了哪些步骤来解决这个问题?如果我的记忆良好,我会用rbenv重新安装所有这些步骤。宝石包也是