Biblioteca non caricata: /usr/local/lib/libpq.5.4.dylib
-
14-11-2019 - |
Domanda
Sto lavorando su un'app per guide.
PostgreSQL installato utilizzando PostgreSQL-9.1.2-1-OSX.DMG
Installato PG Gem.
Quindi quando ho eseguito rake db:create
Ottenere il seguente errore -
.DLOPEN (/Sers/Sathishvc/.Rvm/GEms/ruby-1.9.3-hems/knome-vivacious/gemm/pg-0.12.2/lib/pg_ext.bundle, 9): Libreria non caricata: /usr/local/lib/libpq.5.4.dylib
controllato se esiste o meno
/usr/local/lib/libpq.5.4.dylib
.Non lo fa.
Quindi, dovrebbe essere esistente da qualche altra parte nel sistema o non lo so, se ho bisogno di installare qualsiasi altro software per questo.Consigli Chiunque per favore?
Soluzione 3
Some time after I posted this question, I found that libpq.5.4.dylib
resides in /Library/PostgreSQL/9.1/lib/
.
So, I created the following link:
lrwxr-xr-x 1 sathishvc admin 43 Jan 28 23:40 /usr/local/lib/libpq.5.4.dylib -> /Library/PostgreSQL/9.1/lib/libpq.5.4.dylib
.
This solved the problem then.
Altri suggerimenti
if you have upgraded PostgreSQL with homebrew (brew update && brew upgrade), then simply uninstall the pg gem:
gem uninstall pg
bundle install
and the path will be corrected for you. No need to uninstall the whole PostgreSQL cluster.
I was running into this issue after switching over to the PostgresApp and removing the existing PostgreSQL version via
brew remove postgres
I ultimately solved the problem by re-installing PostgreSQL via
brew install postgres
I was able to retain the use of the PostgresApp by adding the following to my .bash_profile
export PATH="/Applications/Postgres.app/Contents/MacOS/bin:/usr/local/bin:$PATH"
You can also try running:
brew doctor
As it alerted me to this as well as some additional errors.
This error was also affecting my ability to use the Paperclip gem as it was causing ImageMagick to fail with the same error.
(Using OS X 10.8.2)
In my case, uninstalling /reinstalling gem didn't help. But I added the PostgreSQL library path to $DYLD_LIBRARY_PATH
environment variable in my ~/.bash_profile
:
export DYLD_LIBRARY_PATH=/Library/PostgreSQL/9.3/lib:$DYLD_LIBRARY_PATH
If you also have MySQL installed, this line can look like:
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:/Library/PostgreSQL/9.3/lib:$DYLD_LIBRARY_PATH
Of course pay attention to version number in the PostgreSQL path, at the time of this writing it is 9.3. I'm using RVM, Ruby 2.0.0, pg gem 0.17.0, on Mac OS X 10.6.
Try brew prune
and then reinstall
this is not a direct answer to the question but can arise frequently
Two additional cases that might be of interest if you have upgraded PostgreSQL with homebrew:
- you have proceeded in the past to some pruning of gem versions
- your application is older and cannot take a recent version of pg (I have a rails 2 app failing with pg 0.17 and nearly killing the server: the mkmr.log increases exponentially ...try 200GB! )
you may actually have numerous versions of pg to rely upon
when you run
gem uninstall pg
if you have more than one version, the system will ask which version you wish to delete. But that list may be useful to you! As an alternative to awenkhh's answer you may stop there and reset your gems to an acceptable version