0

I have old RoR applications working fine with Postgresql 9.1, on my Mac with Ruby 2.0.0 and Rails 4.0.2

Now I have to do another project and I want to use latest ruby and rails version:

=> ruby-2.2.3@4.2.5 [ x86_64 ]

I can install pg gem without problems I have in config file (insdide .bundle) this

BUNDLE_BUILD__PG: --with-pg-config=/Library/PostgreSQL/9.1/bin/pg_config

Bu when I run "rake db:create" or "rails s" I get this error:

LoadError: dlopen(/Users/albertcatalacasulleras/.rvm/gems/ruby-2.2.3@4.2.5/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.4/pg_ext.bundle, 9): Library not loaded: libz.1.2.6.dylib
  Referenced from: /Users/albertcatalacasulleras/.rvm/gems/ruby-2.2.3@4.2.5/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.4/pg_ext.bundle
  Reason: image not found - /Users/albertcatalacasulleras/.rvm/gems/ruby-2.2.3@4.2.5/extensions/x86_64-darwin-14/2.2.0-static/pg-0.18.4/pg_ext.bundle

I think there is something in Rails 4.2.5 or in Ruby 2.2.3 that makes this crash.

Thanks in advance

Albert Català
  • 2,026
  • 2
  • 29
  • 35

2 Answers2

0

Thanks to this answare of Craig Ringer I found the solution:

Adding export DYLD_LIBRARY_PATH=/library/PostgreSQL/9.1/lib:$DYLD_LIBRARY_PATH to .bash_rofile file

another issue it would be having two PstgreSQL databases 9.1 and 9.4, por example...

Community
  • 1
  • 1
Albert Català
  • 2,026
  • 2
  • 29
  • 35
0

I faced the same type of issue and it is solved for me by uninstalling the pg gem and install it again with the options as like below.

sudo gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config

Search for the pg_config file in the installation path of you postgres app and give that path as shown above.

Please refer the following url for more details.

Github url link

maniempire
  • 791
  • 11
  • 12