Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL and OS X Lion Permission Issues .bash_profile [closed]

SET UP:
I have OS X Lion 10.7.2 installed (not upgraded)
I bought the laptop (no software upgrade)
I have Version 4.2 (4D199) installed

My .bash_profile says the following:

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export PATH="$HOME/.rbenv/bin:$PATH"

When I type 'which psql' I get:

/usr/bin/psql

I have read this post on fixing the postresql Repairing Postgresql after upgrading to OSX 10.7 Lion and in this article it says that the when you type which psql you should be getting:

usr/local/bin/psql

I'm not getting it. What am I doing wrong?


UPDATE - FOR ANYONE

If anyone has the same set up as me do the following: Read this link https://plus.google.com/114301087219148980063/posts/VHmzi63jCJK I have copied and pasted what this person has wrote:

If you've installed or upgraded to Lion, you probably noticed that it now comes with a partial PostgreSQL 9.0.4 installation. Replacing shoddy MySQL with proper beardy Unix database software is no doubt a good thing, but you will quickly notice that the actual PostgreSQL server is missing, as it's part of the "server" version of Lion and not included in the regular flavor. So how do you get your PostgreSQL development server back?

  1. Do not buy Lion Server http://itunes.apple.com/gb/app/os-x-lion-server/id444376097?mt=12. For £35 this should get you the official build of the server part of PostgreSQL, along with a lot of other stuff you most likely don't need. Save the cash and the diskspace.

  2. Do not install the official PostgreSQL Mac package from EnterpriseDB http://www.enterprisedb.com/products-services-training/pgdownload. It's nice of them to provide one, but it's currently not working with Lion (minor user creation issues - although there is a workaround).

  3. Do not Build from source http://cambhlumbulunk.blogspot.com/2011/07/os-x-lion-2-postgresql-as-default.html. This will work, but leave you with a clutter of files in /usr/local that conflict with system files unless you're taking special care.

  4. Do brew install postgresql. Yes, this is almost the same as 3., but the result can be easily removed or updated later. Plus you get nice setup instructions at the end about how to create a database and launch postgres at login. Homebrew Link will also help you set up your environment so that things that require PostgreSQL headers and includes to build (like psycopg2) can find them without any messing around.

FINAL NOTE:

  1. You must have brew installed first.
  2. After you have installed brew then you can install postgresql brew install postgresql
  3. The installation provides EXCELLENT notes for creating your initial DB and starting/stop PostgresSQL for OS X Lion. Save the notes and do the initial create DB
  4. Once you have at this point you can create a db. i.e. psql -d stuff

For the longest time I kept wondering why the initial OS X Lion PostgreSQL was not working and it comes down to it's missing the server version. Anyone else banging their heads on this I hope this reference material helps.

like image 736
alenm Avatar asked Nov 13 '22 12:11

alenm


1 Answers

*.bash_profile* is read on login (if you're using bash as your login shell or if you force its execution with the --login option). Did you try to log off and on after you've modified the initialization file (*.bash_profile* will not be read if you just open a new terminal window)? You may add the path settings to your .bashrc file too (it's read whenever an interactive shell is spawned).

Did you check if psql is actually available in /usr/local/bin ?

like image 108
Dimitre Radoulov Avatar answered Dec 26 '22 11:12

Dimitre Radoulov