

I had PostgreSQL 9.3 and got the same error,Ĭould not connect to server: Connection refused Is the server running I will be glad if this instructions help others who has faced with this problem. Of, course, it's helpful only for local server. It's good way to see your postgres DB as pretty data-tables It starts a local server (port is "5432" and host is "localhost").Ĥ) After all of this manipulations I was glad to run $ createuser -SRDP user_name and other commands and to see that it worked! Postgres93.app can be made to run every time your system starts.ĥ) Also if you wanna see your databases graphically you should install PG Commander.app. The row (command) runs every time console is started.ģ) Launch Postgres93.app from /Applications/ folder. bash_profile (which is in my home directory): export PATH=/Applications/Postgres93.app/Contents/MacOS/bin/:$PATH The best but strange way for me was to do next things.Ģ) Add a row (command) into the file.
#Brew install postgresql full#
In general you can get around this by using the full path to the homebrew postgres binaries but there may be still issues with other programs. Lion comes with a version of postgres already installed and uses those binaries by default. These two files are the -D directory (maybe /usr/local/pgsql/data).įor the nf file, uncomment the listen_address and change it to be: listen_address = '*'įor the pg_hba.conf add the line: host all all 0.0.0.0/0 md5 With postgres running, run the command: ps -ef | grep postmaster

These files are in the data directory but the actual location can be different depending on how postgres was installed. This will also allow connection from a remote ip which is why it is disabled by default. You need to change both the nf file and the pg_hba.conf files so allow connection over a real socket. Hence even though pgadmin and other clients may work, psql will not.
#Brew install postgresql driver#
It does not use the loopback driver but uses a real socket and hence you need to configure postgres to accept socket connections. There is a file called postmaster.pid which should is automatically deleted when postresql exits.
#Brew install postgresql mac#
I encountered this error when running on Mac 10.15.5 using homebrew and seems to be a more updated solution that works where the ones above did not. This is a core requirement which decides which PostgreSQL gets run and is what I'm told leads to most of these issues.įor me, this works rm /usr/local/var/postgres/postmaster.pidĬheck there is no postmaster.pid in your postgres directory, probably /usr/local/var/postgres/

The key thing to take into account is this:Įnsure that the path entry for the copy of PostgreSQL you want to run COMES BEFORE the path to the OS X system's PostgreSQL. Latest insights to help with troubleshooting: $ which psql // This tells you which PostgreSQL you are using when you run $ psql. This is the link where I found a few more things to try, specifically doing the symlink as per above, You'll need to search more on Stack Overflow, but basically you symlink PostgreSQL so that anything looking in that tmp path actually finds the real path, if that makes sense. I've read since that this is occuring because OS X installs its own version of PostgreSQL and Homebrew installs a different version in a different place and the PostgreSQL commands are looking in the /tmp/ directory. Is the server running on host "localhost" (fe80::1) and accepting Is the server running on host "localhost" (::1) and accepting Is the server running on host "localhost" (127.0.0.1) and acceptingĬould not connect to server: Connection refused $ psql -p 5432 -h localhost psql: could not connect to server: Connection refused I tried the following and got a result as below. PS: ~/Library/LaunchAgents includes two PostgreSQL. ps -aef|grep postgres ( ) (develop) ✗ĥ01 17604 11329 0 0:00.00 ttys001 0:00.00 grep postgresīut does this tell me that PostgreSQL is running? ✪ launchctl load -w /usr/local/Cellar/postgresql/9.1.4/ (ruby-1.9.2-p136) So far (I think) this tells me that PostgreSQL is not running(?).

What's wrong and how do I better understand how PostgreSQL is and should be setup on my Mac? Server running locally and accepting connections on Unix domain socket PGError (could not connect to server: No such file or directory. Like some others I am getting this error when I run rake db:migrate in my project or even try most database tasks for my
