简体   繁体   中英

Error with install gem pg

I'm trying to run "bundle install", the only database gem I have in my Gemfile is pg, so I'm getting the following errors.

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.

I can't find anything online, please someone help!

Thanks!!

I had the same problem and the fix for me was setting the bundle config settings first:

bundle config build.pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config

Don't get hung up on the pg gem. Doing the bundle install after doing this bundle config fixed the "make failed" problem for me.

For reference, This was the answer that helped https://stackoverflow.com/a/9235107/3546680 but it was user944938's answer that gave me the correct path to put in. Thanks and hope it helps someone else too!

How did you install postgres. You can install postgres using postgres app from postgresapp.com. Place it into application directory and configure the path of pg gem. gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM