title: Broken brew-installed postgresql on lion
body: <p>I know there are a lot of lion-postgresql related questions on stack overflow already, but none seem to solve my problem.</p>
  
  <p>I installed the homebrew of postgresql and everything was fine after that. Then I messed around a bit with the the libpq.dylib link in /usr/lib so that an application would link to the brew installed version rather than the OS-installed version. Somehow I managed to break my install while doing this in such a way that any call to psql gives the following error:</p>
  
  <pre><code>&gt;psql
  psql: invalid connection option "client_encoding"
  </code></pre>
  
  <p>reinstalling postgresql with 'brew remove postgresql' and another 'brew install postgresql' doesn't seem to help (same error). I've also relinked /usr/lib/libpq.dylib to be /usr/lib/libpq.5.dylib, which is what I believe it was before.</p>
  
  <p>Also, a potentially related problem is that my postgres server doesn't seem to want to shut down:</p>
  
  <pre><code>&gt;pg_ctl -D /usr/local/var/postgres stop -s -m fast     
  pg_ctl: server does not shut down
  </code></pre>
  
  <p>Anyone have any clues as to what is wrong? Alternatively, how would I completely uninstall and reinstall the postgres server and client?</p>