PostgreSQL could not create any TCP/IP sockets' Mavericks
The errors you are getting are because PostgreSQL is running. How do I know? Because it is rejecting your password. That's pretty clear.
Now your real problem is probably that you need to restart PostgreSQL after modifying the pg_hba.conf to give you trust access. Then you can:
ALTER USER foo WITH PASSWORD 'bar';
In terms of starting and restarting PostgreSQL, please see this question: How to start PostgreSQL server on Mac OS X?
Linux: Make sure that your loopback interface is up by running the ifconfig
at the command line. If it's not up, you can use /sbin/ifconfig lo 127.0.0.1
to bring it up.
The error you got is because your host is broken. Check your /etc/hosts
file.
Put 127.0.0.1 localhost
at the first line of hosts.