If you to connect to PostgreSQL without typing a password, you can do it by having your password in the file “.pgpass”.
The file reside in your home directory and must be readable to you only:
touch ~/.pgpass chmod 600 ~/.pgpass
The format is simple:
The “*” means any host using any port.
This of course will work for “psql” and other tools to like “pg_dump”.