简体   繁体   中英

Rails 5: trying to bundle install end getting error with pg gem

I'm using rails 5 and Rubymine and when I try to bundler install I get the following error:

compiling pg_type_map_all_strings.c
compiling pg_type_map_by_class.c
compiling pg_type_map_by_column.c
compiling pg_type_map_by_mri_type.c
compiling pg_type_map_by_oid.c
compiling pg_type_map_in_ruby.c
compiling util.c
linking shared-object pg_ext.bundle
ld: file not found: dynamic_lookup
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pg_ext.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in
/Users/theopap/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/pg-1.0.0 for
inspection.
Results logged to
/Users/theopap/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_6
4-darwin-16/2.4.0-static/pg-1.0.0/gem_make.out

An error occurred while installing pg (1.0.0), and Bundler cannot continue.
Make sure that `gem install pg -v '1.0.0'` succeeds before bundling.

In Gemfile:
  pg

I tried uninstalling the pg gem and installing a fresh one according to this answer from @Neeraj Gupta , but still this error appears after bundler install .

Any ideas why this is happening?

You are probably missing the Postgres Development headers/libraries (libpq-dev).

How did you install Postgres?

If you are on MacOS, you can install Postgres via Homebrew and it will include the necessary development headers for you:

brew install postgresql

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