Can't connect to local Postgres databases After trying to install Postgres using Postgres.app and EnterpriseDB, I decided to re-install it using Homebrew (As I got some problems connecting to database). 

PYTHON=/usr/local/bin/python brew install postgresql
initdb -A trust /usr/local/var/postgres
initdb /usr/local/var/postgres -E utf8


mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.3.2/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist


I am working to create a database using Postgres.
Whenever I try to create database using command line, I got this problem : 

MACBOOK:~ macbook$ postgres -D /usr/local/var/postgres


  LOG:  could not bind IPv6 socket: Address already in use HINT:  Is
  another postmaster already running on port 5432? If not, wait a few
  seconds and retry. LOG:  could not bind IPv4 socket: Address already
  in use HINT:  Is another postmaster already running on port 5432? If
  not, wait a few seconds and retry. LOG:  could not bind IPv6 socket:
  Address already in use HINT:  Is another postmaster already running on
  port 5432? If not, wait a few seconds and retry. WARNING:  could not
  create listen socket for "localhost" FATAL:  could not create any
  TCP/IP sockets


Or I face this problem 


  Is the server running locally and accepting   connections on Unix
  domain socket "/var/pgsql_socket/.s.PGSQL.5432"?


Any ideas to solve this problem?
If you want to run more postgres clusters on a single machine, just make sure that they have their own $PGDATA (the location where their data and config files are)
and make sure that in their postgres.conf the parameter for port differ.
port = 2345
listen_addresses='*'

the cluster can share the listen_addresses but not the port. So each must have it's own port number.