Super User is a question and answer site for computer enthusiasts and power users. 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 am unable to run psql with my normal Mac user account in Terminal session, although I can do it using the postgres service account). When I enter the command psql mydb and type my password, I get the following message:

WARNING: password file "/Users/beh/.pgpass" has group or world access; permissions should be u=rw (0600) or less

But I cannot find .pgpass.

How do I set up and add users to my PostgreSQL 9.1 database on Mac OS X 10.6.8?

share|improve this question
FYI, PostgreSQL has been updated to 9.2. – bwDraco Sep 13 '12 at 21:14

The file .pgpass starts with a dot and therefore is hidden from view by default in most file managers, but you should be able to access it through Terminal. You probably don't need the .pgpass file, so it may be a good idea to delete it. If you do decide to keep it, edit the password file according to the documentation and run chmod 0600 ~/.pgpass to fix the permissions.

PostgreSQL user accounts are independent of the operating system, but remember that unless specified on the command line, psql will use the current user's system username as both the database name and PostgreSQL username; an error will occur if a database or user by this name does not exist on the database cluster. To add users, run psql as the postgres user, then use the CREATE ROLE or CREATE USER SQL commands. Unless the users will connect to the same database, you may want to create databases for each user to avoid errors.

share|improve this answer
Thank you for the response. I think my Mac is corrupted. Even after creating role, it will not allow me to login. I uninstall POSTGRESQL thinking it will get rid of user POSTGRES from MAC and I can start all over again. But when I try to create POSTGRES in system preferences accounts maintenance,it says user is already there even though I cannot see the user. I am using the Mac administrator account. What can I do to correct problem? – Cheng Sep 10 '12 at 20:58
Delete the postgres user using the userdel (or equivalent, if not available on your system) command on the Terminal, then delete the database cluster (stored in /usr/local/var/postgres by default) and reinstall PostgreSQL (which will automatically recreate the postgres account). If the database cluster is not automatically recreated, do so in the same location where it was deleted using the initdb command. – bwDraco Sep 10 '12 at 21:14
Problem solved. Thanks! – Cheng Sep 12 '12 at 21:58
@Cheng: Click on the check below the up/down voting controls to accept this as the best answer, so that the community can see that the problem is solved. – bwDraco Sep 12 '12 at 22:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .