3

I'm using a Mac and I already have installed PostgreSQL in my computer using the dmg provided by PostgreSQL (and not by Postgres.app).

I have installed it because I will go to use it with Django, and for to get the correct functionality with the framework, I had to do the next commands:

export PATH=/Library/PostgreSQL/9.5/bin/:"$PATH”
sudo ln -s /Library/PostgreSQL/9.5/lib/libssl.1.0.0.dylib /usr/lib 
sudo ln -s /Library/PostgreSQL/9.5/lib/libcrypto.1.0.0.dylib /usr/lib

$ sudo mv /usr/lib/libpq.5.dylib /usr/lib/libpq.5.dylib.old  
$ sudo ln -s /Library/PostgreSQL/9.5/lib/libpq.5.dylib /usr/lib

Then I executed the command:

./manage.py migrate

Getting at the terminal a message like this:

enter image description here

And knowing that I needed to create a user "erikb" in PostgreSQL.

I can enter in terminal the command:

sudo su - postgres

To enter to PostgreSQL, but when I wanted to create a DB o a new user, it sent me the next error: -bash: createuser: command not found

enter image description here

Does anyone know which could be the problem?

Regards.

1
  • And if I execute the command which createdb, to know where was installed this function, it doesnt return me anything. Commented Aug 26, 2016 at 21:48

1 Answer 1

3

You set the PATH variable in your user account, and then you su'd to a different user. That user does not inherit your environment, including your path.

You need to set the environment for that user, or else use the full path to the createdb command.

export PATH=/Library/PostgreSQL/9.5/bin/:$PATH
createdb erikb
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.