Error Requiring Pg Under Rvm with Postgres.App

Error requiring pg under rvm with postgres.app

This worked for me:

sudo env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Applications/Postgres93.app/Contents/MacOS/bin/pg_config

Just double check that the /Applications/Postgres93.app.. path exists for you.

Cannot install pg gem in Mavericks with Postgres.app

You probably have the wrong path for --with-pg-config, check if it's actually there.

You can find the correct path to pg_config with:

find /Applications -name pg_config

In the latest Postgres.app Version the path is:

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

unable to install pg gem

Answered here:
Can't install pg gem on Windows

There is no Windows native version of
latest release of pg (0.10.0) released
yesterday, but if you install 0.9.0 it
should install binaries without
issues.

Rails: Installing PG gem on OS X - failure to build native extension

Same error for me and I didn't experience it until I downloaded OS X 10.9 (Mavericks). Sigh, another OS upgrade headache.

Here's how I fixed it (with homebrew):

  • Install another build of Xcode Tools (typing brew update in the terminal will prompt you to update the Xcode build tools)
  • brew update
  • brew install postgresql

After that gem install pg worked for me.

Impossible to Install PG gem on my mac with Mavericks

If you want to avoid using MacPorts, you can download the Postgres App and place it into the Application directory.

Then, specify the location of newly downloaded pg_config:

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

If you run in to missing headers problem, try specifying the include directory of the app:

gem install pg -- --with-pg-include='/Applications/Postgres.app/Contents/Versions/latest/include/'

Postgres.app upgrade, now Rails app won't start

I found a solution that works for me and requires minimal hacking/configuring. You only need to do this once and it will work for every bundle install. Add the following to your .bash_profile, .bash_rc, or equivalent:

export DYLD_FALLBACK_LIBRARY_PATH=/Applications/Postgres.app/Contents/MacOS/lib:$DYLD_LIBRARY_PATH

(Assuming you installed Postgres.app in the default location). Then restart your terminal session and try again.

Exporting to DYLD_LIBRARY_PATH directly can cause serious problems with other apps that depend on it, but using the fallback path avoids these problems.

See also:

  • Error requiring pg under rvm with postgres.app
  • https://github.com/PostgresApp/PostgresApp/issues/109#issuecomment-18387546

EDIT: It seems that setting DYLD_FALLBACK_LIBRARY_PATH causes an error when you try to run psql. To fix this, you can add the following two lines to your .bash_profile:

alias psql="(. ~/.bash_profile; unset DYLD_FALLBACK_LIBRARY_PATH; psql)";

This is assuming that you're using bash and that your .bash_profile is located in your home directory. If that's not the case (or if you're using a .bashrc or other environment setup instead of .bash_profile) change the ~/.bash_profile part of the command to the path to your environment setup script.

The aliased commands basically start a subshell which does not effect your current bash environment. So when it unsets the DYLD_FALLBACK_LIBRARY_PATH variable, it's only temporary. After you exit psql the environment variable will be set again so that rails functions properly.

PostgreSQL database no longer working in my Ruby On Rails app

The inital error was caused by me running Brew Upgrade which updated Postgresql from 9x (it really wasn't clear from the directories) to Postgresql 9.3. I didn't realise what had happened at the time.

This caused Postgresql to not start up as running version 9.3 and data structures were from 9.2 (I think). When I figured ot what happened I tried to back out the change - which I couldn't do. I then tried to update the data (using a number of webpages esp http://blog.55minutes.com/2013/09/postgresql-93-brew-upgrade/. As I couldn't find the data dictionary for the old version I had to set up the Postgresql 9.3 database from scratch making sure to sure same databse name etc and then running rake db:schema:load and had some data in rake db:init.

Pierre



Related Topics



Leave a reply



Submit