Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was using web-sharing and accessing some webpages that I had developed using localhost. I messed up a PostGreSQL installation and deleted anything related to PostGreSQL and in the process appear to have damaged my apache installation.

If I run ping localhost the result is

--- localhost ping statistics --- 794 packets transmitted, 794 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.033/0.076/0.920/0.055 ms

I then tried running apachectl configtest and recieved the following output:

Library not loaded: /usr/lib/libpq.5.dylib   Referenced from: /usr/sbin/httpd
Reason: image not found /usr/sbin/apachectl: line 90: 16227 Trace/BPT trap: 5       $HTTPD -t

I also tried

curl http://localhost || echo $? curl: (7) couldn't connect to host 7

Within System Preferences->Sharing->Web Sharing when I try to tick web-sharing I end up with it being unticked automatically. I'm fairly sure that my local webserver is not working, but I'm not sure what I can do to fix this problem.

share|improve this question
I've also tried the instructions in this thread: – celenius Oct 12 '12 at 2:21
What does ls -l /usr/lib/libpq.5.dylib show? – patrix Oct 13 '12 at 18:10
It shows lrwxr-xr-x 1 root wheel 41 Aug 22 09:14 /usr/lib/libpq.5.dylib -> /Library/PostgreSQL/9.1/lib/libpq.5.dylib – celenius Oct 13 '12 at 18:25
Aha, broken symlink. Try ls -l /usr/lib/libpq.* next. – patrix Oct 13 '12 at 18:30
-rwxr-xr-x 1 root wheel 291680 Feb 20 2012 /usr/lib/libpq.5.3.dylib lrwxr-xr-x 1 root wheel 41 Aug 22 09:14 /usr/lib/libpq.5.dylib -> /Library/PostgreSQL/9.1/lib/libpq.5.dylib -rw-r--r-- 1 root wheel 1602000 Sep 8 2011 /usr/lib/libpq.a lrwxr-xr-x 1 root wheel 15 Feb 20 2012 /usr/lib/libpq.dylib -> libpq.5.3.dylib – celenius Oct 13 '12 at 18:32
up vote 1 down vote accepted

Judging from your feedback in the comments, the installation of PostgreSQL brought its own version of libpq (which then got removed during un-install). To fix

cd /usr/lib
sudo rm libpq.5.dylib
sudo ln -s libpq.5.3.dylib libpq.5.dylib

Then run apachectl configtest again to check for further errors.

share|improve this answer
Thanks for the suggestions. I ran the above code, and the output from apachectl configtest is the following: httpd: Could not reliably determine the server's fully qualified domain name, using celenius.local for ServerName Syntax OK – celenius Oct 13 '12 at 20:14
Disable/enable Web Sharing again then and point your browser to localhost – patrix Oct 14 '12 at 5:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.