我试图运行"捆绑安装",我在我的Gemfile中唯一拥有的数据库宝石是pg,所以我收到以下错误。
bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
...
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/MacOS/bin/pg_config
Using config values from /Applications/Postgres.app/Contents/MacOS/bin/pg_config
sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
sh: /Applications/Postgres.app/Contents/MacOS/bin/pg_config: No such file or directory
checking for libpq-fe.h... yes
...
creating extconf.h
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_connection.c
compiling pg_errors.c
compiling pg_result.c
linking shared-object pg_ext.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [pg_ext.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/marklalich/.bundler/tmp/14076/gems/pg-0.17.1 for inspection.
Results logged to /Users/marklalich/.bundler/tmp/14076/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.
我无法在网上找到任何内容,请有人帮忙!
谢谢!
答案 0 :(得分:2)
我遇到了同样的问题,我的修复方法是首先设置捆绑配置设置:
bundle config build.pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
不要挂在pg gem上。执行此捆绑包配置后执行捆绑安装修复了" make failed"我的问题。
作为参考,这是帮助https://stackoverflow.com/a/9235107/3546680的答案,但是user944938的答案给了我正确的路径。感谢并希望它也帮助其他人!
答案 1 :(得分:0)
你是如何安装postgres的?您可以使用postgresapp.com上的postgres应用安装postgres。将其放入应用程序目录并配置pg gem的路径。 gem install pg - --with-pg-config = / Applications / Postgres.app / Contents / Versions / 9.3 / bin / pg_config