1

I'm new to Python/Django so forgive me if this is a simple problem to solve...

I'm trying to set up a PostgreSQL database for my Django project. I have downloaded PostgreSQL 9.2 from here http://www.postgresql.org/download/macosx/ and gone through the installation process. I've been following a wiki article which said to update my system path to /Library/PostgreSQL/9.2/bin, which I have. When I type 'nano ~/.bash_profile' into Terminal I see this 'PATH ='Library/PostgreSQL/9.2/bin' which I believe means I have updated my system path correctly. However, when I then try to run the command 'createdb', I see this...

-bash: createdb: command not found

I believe I have installed PostgreSQL correctly so I'm not sure how to get around this.

Any help would be very much appreciated!

Thank you

Jess

2 Answers 2

2

PATH ='Library/PostgreSQL/9.2/bin is overwriting your global $PATH with just the PostgreSQL binaries. It should be the following instead:

PATH="$PATH:/Library/PostgreSQL/9.2/bin"

This appends the PostgreSQL bin directory to your $PATH, instead of overwriting it. Don't forget to start a new terminal session after you make the edit, or do the following in your current session:

source ~/.bash_profile

In general, the best way to install open source software, packages and utilities on OSX is to use homebrew. Homebrew is a package manager for OSX to simplify the installation and management of programs such as PostgreSQL, and many other popular open source projects. Check it out!

3
  • Thank you. I'll get homebrew. Just to make sure I'm doing it correctly, to update my system path to PATH="$PATH:Library/PostgreSQL/9.2/bin" do I use 'nano ~/.bash_profile', then edit the text after 'PATH = ' and then save by using ^X to Exit and then Y to save the changes? Sorry if this is really simple - it's my first time.
    – Jess
    Oct 3, 2012 at 14:56
  • Yeah if you want to use a command line editor, but it might be more straightforward to use TextEdit. Run this and replace the line with the one I wrote above when TextEdit opens: open -a TextEdit ~/.bash_profile Oct 3, 2012 at 15:00
  • Sorry to send another question your way! I've just tried to run 'python manage.py runserver' and the response I'm getting is 'Error: No module named psycopg2.extensions'. Do you know how I fix that?
    – Jess
    Oct 4, 2012 at 10:02
0

While it's not exactly an answer to your "question", it might solve the problem for you. Have you checked out the PostgreSQL "app"? It's created by Matt Thompson & supported by Heroku Postgres and is meant to make PostgreSQL development easier for people using Mac. You might want to give it a look. Here's a link. Or just google "Postgresapp".

2
  • Hi David, thank you for the link. I've downloaded it and just tried to open the app but I'm being told it doesn't work with my version of Mac OS X (which is 10.6.8).
    – Jess
    Oct 3, 2012 at 17:59
  • @Jess Well, sorry it wasn't of any use to you. I hope you figure things out. I use Django + PostgreSQL all the time and love it, but I'm on Linux.
    – David S
    Oct 3, 2012 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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