PostgreSQL not running on Mac
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
The error in its entirety reads:
psql: could not connect to server: No such file or directory. Is the
server running locally and accepting connections on Unix domain socket
"/tmp/.s.PGSQL.5432"?
This is my second time setting up Postgresql via Homebrew on my Mac, and I have no clue what is going on. Previously, it had been working. At some point, I must've entered a command that messed things up. I'm not sure. Now, whenever I enter a SQL command from the command line, I receive the above message. I've run a command to check whether the server is running, and it apparently is not. If I attempt to start the server using
$ postgres -D /usr/local/pgsql/data
I receive the following error:
postgres cannot access the server configuration file
"/usr/local/pgsql/data/postgresql.conf": No such file or directory
I've uninstalled and reinstalled Postgresql via Homebrew, but the problem persists. I'm completely at a loss as to how to get this working. Any help would be appreciated.
postgresql
add a comment |
The error in its entirety reads:
psql: could not connect to server: No such file or directory. Is the
server running locally and accepting connections on Unix domain socket
"/tmp/.s.PGSQL.5432"?
This is my second time setting up Postgresql via Homebrew on my Mac, and I have no clue what is going on. Previously, it had been working. At some point, I must've entered a command that messed things up. I'm not sure. Now, whenever I enter a SQL command from the command line, I receive the above message. I've run a command to check whether the server is running, and it apparently is not. If I attempt to start the server using
$ postgres -D /usr/local/pgsql/data
I receive the following error:
postgres cannot access the server configuration file
"/usr/local/pgsql/data/postgresql.conf": No such file or directory
I've uninstalled and reinstalled Postgresql via Homebrew, but the problem persists. I'm completely at a loss as to how to get this working. Any help would be appreciated.
postgresql
add a comment |
The error in its entirety reads:
psql: could not connect to server: No such file or directory. Is the
server running locally and accepting connections on Unix domain socket
"/tmp/.s.PGSQL.5432"?
This is my second time setting up Postgresql via Homebrew on my Mac, and I have no clue what is going on. Previously, it had been working. At some point, I must've entered a command that messed things up. I'm not sure. Now, whenever I enter a SQL command from the command line, I receive the above message. I've run a command to check whether the server is running, and it apparently is not. If I attempt to start the server using
$ postgres -D /usr/local/pgsql/data
I receive the following error:
postgres cannot access the server configuration file
"/usr/local/pgsql/data/postgresql.conf": No such file or directory
I've uninstalled and reinstalled Postgresql via Homebrew, but the problem persists. I'm completely at a loss as to how to get this working. Any help would be appreciated.
postgresql
The error in its entirety reads:
psql: could not connect to server: No such file or directory. Is the
server running locally and accepting connections on Unix domain socket
"/tmp/.s.PGSQL.5432"?
This is my second time setting up Postgresql via Homebrew on my Mac, and I have no clue what is going on. Previously, it had been working. At some point, I must've entered a command that messed things up. I'm not sure. Now, whenever I enter a SQL command from the command line, I receive the above message. I've run a command to check whether the server is running, and it apparently is not. If I attempt to start the server using
$ postgres -D /usr/local/pgsql/data
I receive the following error:
postgres cannot access the server configuration file
"/usr/local/pgsql/data/postgresql.conf": No such file or directory
I've uninstalled and reinstalled Postgresql via Homebrew, but the problem persists. I'm completely at a loss as to how to get this working. Any help would be appreciated.
postgresql
postgresql
edited Jan 4 '18 at 9:02
dezso
22.5k116097
22.5k116097
asked Aug 28 '14 at 14:50
Michael P.Michael P.
611167
611167
add a comment |
add a comment |
11 Answers
11
active
oldest
votes
The answer is here.
Run this command to manually start the server:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
add a comment |
The problem can also be attributed to a crashed process that left postmaster.pid file behind.
$ brew services stop postgresql
$ rm /usr/local/var/postgres/postmaster.pid # adjust path accordingly to your install
$ brew services start postgresql
2
On MacOSX, this answer saved me. Had the same error as OP after my computer hard rebooted. Thebrew servicescommand were not helpful because they made it seem like everything was working. Removing thepostmaster.pidis what finally got everything working again. Thanks!
– vinhboy
Mar 5 '18 at 22:47
add a comment |
I've just resolved the same problem. It's just because I forgot to run it properly before use.
For pure installing postgresql on Mac OS, the process will be (using brew command):
brew install postgresql
then if you want to automatically run postgresql at login:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
or else you just want to run it anytime you want:
postgres -D /usr/local/var/postgres
If your case is more complicated, let's brew uninstall postgresql and redo these steps.
Hope it helps!
add a comment |
I was getting the same
Is the server running locally and accepting connections on Unix domain
socket "/tmp/.s.PGSQL.5432"?
loop of Homebrew install / start / stop / restart to no avail...
Finally, brew postgresql-upgrade-database worked.
Seems I was on 9.6 instead of 10.4, and something my latest App Store restart restarted all my database servers...
this worked for me
– davideghz
Mar 4 at 9:13
Thatbrew postgresql-upgrade-databaseis what I was missing. Thanks for pointing that out.
– Corin
Mar 18 at 16:20
add a comment |
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket"/var/pgsql_socket/.s.PGSQL.5432"?
I kept on getting the above error and none of the above solutions worked for me. Finally the following solution solved my problem on Mac OS X
Install postgres using brew
brew install postgres
Install brew services
brew tap homebrew/services
To start postgres as a background service
brew services start postgresql
To stop postgres manually
brew services stop postgresql
We can also use brew services to restart Postgres
brew services restart postgresql
add a comment |
I just uncomment in /etc/postgresql/9.5/main/postgresql.conf
unix_socket_permissions = 0777
and restart postgres.
And for me it works.
add a comment |
recently I went thru a similar problem. there's just another problem and solution. I was running 2 version of postgres (9.3 and 9.6) although the server was set to run on 2 different port but some how the psql command on bash try to connect to default port 5432.
Make sure to check if your server is running and check your port settings, then run psql -p <port> postgres.
The solution is changing port.
add a comment |
This happens when postgres server is not running.
Steps to properly install Postgres via Homebrew on MAC :
brew install postgresinitdb /Users/<username>/db -E utf8
[This initializes postgres to use the given directory as the database directory. Normally it is not adviced to use the user directory for database storage. Edit sudoers file to add initdb and similar commands and then run initdb on /usr/local/var/postgres]pg_ctl -D /Users/<username>/db -l logfile start
[After getting success with step 2 it will prompt to run step 3. This command manually starts the server.]
add a comment |
I was looking for a long time, and this was the most clean and neat solution:
I recently upgraded Postgres from 9.2 to 9.3 using brew upgrade postgres. The process was smooth and pg_upgrade is a very handy tool.
However, trouble struck once I tried to run any specs that needed to connect to Postgres. Even though Postgres was definitely running, suddenly I was getting:
could not connect to server: No such file or directory (PG::ConnectionBad)
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
The problem was that the new version of Postgres listens on /tmp/.s.PGSQL.5432 instead. I could’ve messed around with the config and made Postgres use the domain socket it was previously, or told Rails explictly how to connect, but both of those approaches seemed like work I shouldn’t have to do. At no point had I told Rails to connect to postgres on that path, Rails had assumed it, and now its assumptions were wrong.
The fix is simple, if a little suprising. When you install the ‘pg’ gem, it detects which version of Postgres is installed and sets the domain socket path appropriately. The solution is as simple as reinstalling the gem.
$ gem uninstall pg
$ cd my-rails-app/
$ bundle install
http://daniel.fone.net.nz/blog/2014/12/01/fixing-connection-errors-after-upgrading-postgres/
1
Please edit your answer so it provides value if the link stops working. You can find guidance on how to do this correctly in How to reference material written by others. Thank you.
– Paul White♦
Aug 10 '18 at 20:36
add a comment |
It worked for me.
Change your postgresql directory according to version in your system.
Common path-
rm /usr/local/var/postgres/postmaster.pid
but for postgresql@9.6 in my system path is
rm /usr/local/var/postgresql@9.6/postmaster.pid
restart postgresql@9.6-
brew services restart postgresql@9.6
add a comment |
The steps below helps me:
brew uninstall postgresql
brew install postgresql
brew postgresql-upgrade-database
New contributor
BMA88 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f75214%2fpostgresql-not-running-on-mac%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
11 Answers
11
active
oldest
votes
11 Answers
11
active
oldest
votes
active
oldest
votes
active
oldest
votes
The answer is here.
Run this command to manually start the server:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
add a comment |
The answer is here.
Run this command to manually start the server:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
add a comment |
The answer is here.
Run this command to manually start the server:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
The answer is here.
Run this command to manually start the server:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
edited May 23 '17 at 12:40
Community♦
1
1
answered Aug 28 '14 at 15:36
Michael P.Michael P.
611167
611167
add a comment |
add a comment |
The problem can also be attributed to a crashed process that left postmaster.pid file behind.
$ brew services stop postgresql
$ rm /usr/local/var/postgres/postmaster.pid # adjust path accordingly to your install
$ brew services start postgresql
2
On MacOSX, this answer saved me. Had the same error as OP after my computer hard rebooted. Thebrew servicescommand were not helpful because they made it seem like everything was working. Removing thepostmaster.pidis what finally got everything working again. Thanks!
– vinhboy
Mar 5 '18 at 22:47
add a comment |
The problem can also be attributed to a crashed process that left postmaster.pid file behind.
$ brew services stop postgresql
$ rm /usr/local/var/postgres/postmaster.pid # adjust path accordingly to your install
$ brew services start postgresql
2
On MacOSX, this answer saved me. Had the same error as OP after my computer hard rebooted. Thebrew servicescommand were not helpful because they made it seem like everything was working. Removing thepostmaster.pidis what finally got everything working again. Thanks!
– vinhboy
Mar 5 '18 at 22:47
add a comment |
The problem can also be attributed to a crashed process that left postmaster.pid file behind.
$ brew services stop postgresql
$ rm /usr/local/var/postgres/postmaster.pid # adjust path accordingly to your install
$ brew services start postgresql
The problem can also be attributed to a crashed process that left postmaster.pid file behind.
$ brew services stop postgresql
$ rm /usr/local/var/postgres/postmaster.pid # adjust path accordingly to your install
$ brew services start postgresql
answered Apr 20 '17 at 23:37
demisxdemisx
29124
29124
2
On MacOSX, this answer saved me. Had the same error as OP after my computer hard rebooted. Thebrew servicescommand were not helpful because they made it seem like everything was working. Removing thepostmaster.pidis what finally got everything working again. Thanks!
– vinhboy
Mar 5 '18 at 22:47
add a comment |
2
On MacOSX, this answer saved me. Had the same error as OP after my computer hard rebooted. Thebrew servicescommand were not helpful because they made it seem like everything was working. Removing thepostmaster.pidis what finally got everything working again. Thanks!
– vinhboy
Mar 5 '18 at 22:47
2
2
On MacOSX, this answer saved me. Had the same error as OP after my computer hard rebooted. The
brew services command were not helpful because they made it seem like everything was working. Removing the postmaster.pid is what finally got everything working again. Thanks!– vinhboy
Mar 5 '18 at 22:47
On MacOSX, this answer saved me. Had the same error as OP after my computer hard rebooted. The
brew services command were not helpful because they made it seem like everything was working. Removing the postmaster.pid is what finally got everything working again. Thanks!– vinhboy
Mar 5 '18 at 22:47
add a comment |
I've just resolved the same problem. It's just because I forgot to run it properly before use.
For pure installing postgresql on Mac OS, the process will be (using brew command):
brew install postgresql
then if you want to automatically run postgresql at login:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
or else you just want to run it anytime you want:
postgres -D /usr/local/var/postgres
If your case is more complicated, let's brew uninstall postgresql and redo these steps.
Hope it helps!
add a comment |
I've just resolved the same problem. It's just because I forgot to run it properly before use.
For pure installing postgresql on Mac OS, the process will be (using brew command):
brew install postgresql
then if you want to automatically run postgresql at login:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
or else you just want to run it anytime you want:
postgres -D /usr/local/var/postgres
If your case is more complicated, let's brew uninstall postgresql and redo these steps.
Hope it helps!
add a comment |
I've just resolved the same problem. It's just because I forgot to run it properly before use.
For pure installing postgresql on Mac OS, the process will be (using brew command):
brew install postgresql
then if you want to automatically run postgresql at login:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
or else you just want to run it anytime you want:
postgres -D /usr/local/var/postgres
If your case is more complicated, let's brew uninstall postgresql and redo these steps.
Hope it helps!
I've just resolved the same problem. It's just because I forgot to run it properly before use.
For pure installing postgresql on Mac OS, the process will be (using brew command):
brew install postgresql
then if you want to automatically run postgresql at login:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
or else you just want to run it anytime you want:
postgres -D /usr/local/var/postgres
If your case is more complicated, let's brew uninstall postgresql and redo these steps.
Hope it helps!
edited Sep 9 '15 at 16:36
answered Sep 9 '15 at 16:17
Hoang LeHoang Le
20125
20125
add a comment |
add a comment |
I was getting the same
Is the server running locally and accepting connections on Unix domain
socket "/tmp/.s.PGSQL.5432"?
loop of Homebrew install / start / stop / restart to no avail...
Finally, brew postgresql-upgrade-database worked.
Seems I was on 9.6 instead of 10.4, and something my latest App Store restart restarted all my database servers...
this worked for me
– davideghz
Mar 4 at 9:13
Thatbrew postgresql-upgrade-databaseis what I was missing. Thanks for pointing that out.
– Corin
Mar 18 at 16:20
add a comment |
I was getting the same
Is the server running locally and accepting connections on Unix domain
socket "/tmp/.s.PGSQL.5432"?
loop of Homebrew install / start / stop / restart to no avail...
Finally, brew postgresql-upgrade-database worked.
Seems I was on 9.6 instead of 10.4, and something my latest App Store restart restarted all my database servers...
this worked for me
– davideghz
Mar 4 at 9:13
Thatbrew postgresql-upgrade-databaseis what I was missing. Thanks for pointing that out.
– Corin
Mar 18 at 16:20
add a comment |
I was getting the same
Is the server running locally and accepting connections on Unix domain
socket "/tmp/.s.PGSQL.5432"?
loop of Homebrew install / start / stop / restart to no avail...
Finally, brew postgresql-upgrade-database worked.
Seems I was on 9.6 instead of 10.4, and something my latest App Store restart restarted all my database servers...
I was getting the same
Is the server running locally and accepting connections on Unix domain
socket "/tmp/.s.PGSQL.5432"?
loop of Homebrew install / start / stop / restart to no avail...
Finally, brew postgresql-upgrade-database worked.
Seems I was on 9.6 instead of 10.4, and something my latest App Store restart restarted all my database servers...
answered Jun 12 '18 at 2:39
senbenitosenbenito
8111
8111
this worked for me
– davideghz
Mar 4 at 9:13
Thatbrew postgresql-upgrade-databaseis what I was missing. Thanks for pointing that out.
– Corin
Mar 18 at 16:20
add a comment |
this worked for me
– davideghz
Mar 4 at 9:13
Thatbrew postgresql-upgrade-databaseis what I was missing. Thanks for pointing that out.
– Corin
Mar 18 at 16:20
this worked for me
– davideghz
Mar 4 at 9:13
this worked for me
– davideghz
Mar 4 at 9:13
That
brew postgresql-upgrade-database is what I was missing. Thanks for pointing that out.– Corin
Mar 18 at 16:20
That
brew postgresql-upgrade-database is what I was missing. Thanks for pointing that out.– Corin
Mar 18 at 16:20
add a comment |
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket"/var/pgsql_socket/.s.PGSQL.5432"?
I kept on getting the above error and none of the above solutions worked for me. Finally the following solution solved my problem on Mac OS X
Install postgres using brew
brew install postgres
Install brew services
brew tap homebrew/services
To start postgres as a background service
brew services start postgresql
To stop postgres manually
brew services stop postgresql
We can also use brew services to restart Postgres
brew services restart postgresql
add a comment |
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket"/var/pgsql_socket/.s.PGSQL.5432"?
I kept on getting the above error and none of the above solutions worked for me. Finally the following solution solved my problem on Mac OS X
Install postgres using brew
brew install postgres
Install brew services
brew tap homebrew/services
To start postgres as a background service
brew services start postgresql
To stop postgres manually
brew services stop postgresql
We can also use brew services to restart Postgres
brew services restart postgresql
add a comment |
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket"/var/pgsql_socket/.s.PGSQL.5432"?
I kept on getting the above error and none of the above solutions worked for me. Finally the following solution solved my problem on Mac OS X
Install postgres using brew
brew install postgres
Install brew services
brew tap homebrew/services
To start postgres as a background service
brew services start postgresql
To stop postgres manually
brew services stop postgresql
We can also use brew services to restart Postgres
brew services restart postgresql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket"/var/pgsql_socket/.s.PGSQL.5432"?
I kept on getting the above error and none of the above solutions worked for me. Finally the following solution solved my problem on Mac OS X
Install postgres using brew
brew install postgres
Install brew services
brew tap homebrew/services
To start postgres as a background service
brew services start postgresql
To stop postgres manually
brew services stop postgresql
We can also use brew services to restart Postgres
brew services restart postgresql
answered Jan 23 '17 at 12:30
SudharshanSudharshan
1312
1312
add a comment |
add a comment |
I just uncomment in /etc/postgresql/9.5/main/postgresql.conf
unix_socket_permissions = 0777
and restart postgres.
And for me it works.
add a comment |
I just uncomment in /etc/postgresql/9.5/main/postgresql.conf
unix_socket_permissions = 0777
and restart postgres.
And for me it works.
add a comment |
I just uncomment in /etc/postgresql/9.5/main/postgresql.conf
unix_socket_permissions = 0777
and restart postgres.
And for me it works.
I just uncomment in /etc/postgresql/9.5/main/postgresql.conf
unix_socket_permissions = 0777
and restart postgres.
And for me it works.
answered Nov 14 '16 at 12:44
RoxanaRoxana
111
111
add a comment |
add a comment |
recently I went thru a similar problem. there's just another problem and solution. I was running 2 version of postgres (9.3 and 9.6) although the server was set to run on 2 different port but some how the psql command on bash try to connect to default port 5432.
Make sure to check if your server is running and check your port settings, then run psql -p <port> postgres.
The solution is changing port.
add a comment |
recently I went thru a similar problem. there's just another problem and solution. I was running 2 version of postgres (9.3 and 9.6) although the server was set to run on 2 different port but some how the psql command on bash try to connect to default port 5432.
Make sure to check if your server is running and check your port settings, then run psql -p <port> postgres.
The solution is changing port.
add a comment |
recently I went thru a similar problem. there's just another problem and solution. I was running 2 version of postgres (9.3 and 9.6) although the server was set to run on 2 different port but some how the psql command on bash try to connect to default port 5432.
Make sure to check if your server is running and check your port settings, then run psql -p <port> postgres.
The solution is changing port.
recently I went thru a similar problem. there's just another problem and solution. I was running 2 version of postgres (9.3 and 9.6) although the server was set to run on 2 different port but some how the psql command on bash try to connect to default port 5432.
Make sure to check if your server is running and check your port settings, then run psql -p <port> postgres.
The solution is changing port.
answered Mar 31 '17 at 12:08
rainrain
112
112
add a comment |
add a comment |
This happens when postgres server is not running.
Steps to properly install Postgres via Homebrew on MAC :
brew install postgresinitdb /Users/<username>/db -E utf8
[This initializes postgres to use the given directory as the database directory. Normally it is not adviced to use the user directory for database storage. Edit sudoers file to add initdb and similar commands and then run initdb on /usr/local/var/postgres]pg_ctl -D /Users/<username>/db -l logfile start
[After getting success with step 2 it will prompt to run step 3. This command manually starts the server.]
add a comment |
This happens when postgres server is not running.
Steps to properly install Postgres via Homebrew on MAC :
brew install postgresinitdb /Users/<username>/db -E utf8
[This initializes postgres to use the given directory as the database directory. Normally it is not adviced to use the user directory for database storage. Edit sudoers file to add initdb and similar commands and then run initdb on /usr/local/var/postgres]pg_ctl -D /Users/<username>/db -l logfile start
[After getting success with step 2 it will prompt to run step 3. This command manually starts the server.]
add a comment |
This happens when postgres server is not running.
Steps to properly install Postgres via Homebrew on MAC :
brew install postgresinitdb /Users/<username>/db -E utf8
[This initializes postgres to use the given directory as the database directory. Normally it is not adviced to use the user directory for database storage. Edit sudoers file to add initdb and similar commands and then run initdb on /usr/local/var/postgres]pg_ctl -D /Users/<username>/db -l logfile start
[After getting success with step 2 it will prompt to run step 3. This command manually starts the server.]
This happens when postgres server is not running.
Steps to properly install Postgres via Homebrew on MAC :
brew install postgresinitdb /Users/<username>/db -E utf8
[This initializes postgres to use the given directory as the database directory. Normally it is not adviced to use the user directory for database storage. Edit sudoers file to add initdb and similar commands and then run initdb on /usr/local/var/postgres]pg_ctl -D /Users/<username>/db -l logfile start
[After getting success with step 2 it will prompt to run step 3. This command manually starts the server.]
answered Jan 4 '18 at 6:53
Souvik DasSouvik Das
111
111
add a comment |
add a comment |
I was looking for a long time, and this was the most clean and neat solution:
I recently upgraded Postgres from 9.2 to 9.3 using brew upgrade postgres. The process was smooth and pg_upgrade is a very handy tool.
However, trouble struck once I tried to run any specs that needed to connect to Postgres. Even though Postgres was definitely running, suddenly I was getting:
could not connect to server: No such file or directory (PG::ConnectionBad)
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
The problem was that the new version of Postgres listens on /tmp/.s.PGSQL.5432 instead. I could’ve messed around with the config and made Postgres use the domain socket it was previously, or told Rails explictly how to connect, but both of those approaches seemed like work I shouldn’t have to do. At no point had I told Rails to connect to postgres on that path, Rails had assumed it, and now its assumptions were wrong.
The fix is simple, if a little suprising. When you install the ‘pg’ gem, it detects which version of Postgres is installed and sets the domain socket path appropriately. The solution is as simple as reinstalling the gem.
$ gem uninstall pg
$ cd my-rails-app/
$ bundle install
http://daniel.fone.net.nz/blog/2014/12/01/fixing-connection-errors-after-upgrading-postgres/
1
Please edit your answer so it provides value if the link stops working. You can find guidance on how to do this correctly in How to reference material written by others. Thank you.
– Paul White♦
Aug 10 '18 at 20:36
add a comment |
I was looking for a long time, and this was the most clean and neat solution:
I recently upgraded Postgres from 9.2 to 9.3 using brew upgrade postgres. The process was smooth and pg_upgrade is a very handy tool.
However, trouble struck once I tried to run any specs that needed to connect to Postgres. Even though Postgres was definitely running, suddenly I was getting:
could not connect to server: No such file or directory (PG::ConnectionBad)
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
The problem was that the new version of Postgres listens on /tmp/.s.PGSQL.5432 instead. I could’ve messed around with the config and made Postgres use the domain socket it was previously, or told Rails explictly how to connect, but both of those approaches seemed like work I shouldn’t have to do. At no point had I told Rails to connect to postgres on that path, Rails had assumed it, and now its assumptions were wrong.
The fix is simple, if a little suprising. When you install the ‘pg’ gem, it detects which version of Postgres is installed and sets the domain socket path appropriately. The solution is as simple as reinstalling the gem.
$ gem uninstall pg
$ cd my-rails-app/
$ bundle install
http://daniel.fone.net.nz/blog/2014/12/01/fixing-connection-errors-after-upgrading-postgres/
1
Please edit your answer so it provides value if the link stops working. You can find guidance on how to do this correctly in How to reference material written by others. Thank you.
– Paul White♦
Aug 10 '18 at 20:36
add a comment |
I was looking for a long time, and this was the most clean and neat solution:
I recently upgraded Postgres from 9.2 to 9.3 using brew upgrade postgres. The process was smooth and pg_upgrade is a very handy tool.
However, trouble struck once I tried to run any specs that needed to connect to Postgres. Even though Postgres was definitely running, suddenly I was getting:
could not connect to server: No such file or directory (PG::ConnectionBad)
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
The problem was that the new version of Postgres listens on /tmp/.s.PGSQL.5432 instead. I could’ve messed around with the config and made Postgres use the domain socket it was previously, or told Rails explictly how to connect, but both of those approaches seemed like work I shouldn’t have to do. At no point had I told Rails to connect to postgres on that path, Rails had assumed it, and now its assumptions were wrong.
The fix is simple, if a little suprising. When you install the ‘pg’ gem, it detects which version of Postgres is installed and sets the domain socket path appropriately. The solution is as simple as reinstalling the gem.
$ gem uninstall pg
$ cd my-rails-app/
$ bundle install
http://daniel.fone.net.nz/blog/2014/12/01/fixing-connection-errors-after-upgrading-postgres/
I was looking for a long time, and this was the most clean and neat solution:
I recently upgraded Postgres from 9.2 to 9.3 using brew upgrade postgres. The process was smooth and pg_upgrade is a very handy tool.
However, trouble struck once I tried to run any specs that needed to connect to Postgres. Even though Postgres was definitely running, suddenly I was getting:
could not connect to server: No such file or directory (PG::ConnectionBad)
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
The problem was that the new version of Postgres listens on /tmp/.s.PGSQL.5432 instead. I could’ve messed around with the config and made Postgres use the domain socket it was previously, or told Rails explictly how to connect, but both of those approaches seemed like work I shouldn’t have to do. At no point had I told Rails to connect to postgres on that path, Rails had assumed it, and now its assumptions were wrong.
The fix is simple, if a little suprising. When you install the ‘pg’ gem, it detects which version of Postgres is installed and sets the domain socket path appropriately. The solution is as simple as reinstalling the gem.
$ gem uninstall pg
$ cd my-rails-app/
$ bundle install
http://daniel.fone.net.nz/blog/2014/12/01/fixing-connection-errors-after-upgrading-postgres/
edited Aug 10 '18 at 20:38
answered Aug 10 '18 at 20:33
jalebarojalebaro
112
112
1
Please edit your answer so it provides value if the link stops working. You can find guidance on how to do this correctly in How to reference material written by others. Thank you.
– Paul White♦
Aug 10 '18 at 20:36
add a comment |
1
Please edit your answer so it provides value if the link stops working. You can find guidance on how to do this correctly in How to reference material written by others. Thank you.
– Paul White♦
Aug 10 '18 at 20:36
1
1
Please edit your answer so it provides value if the link stops working. You can find guidance on how to do this correctly in How to reference material written by others. Thank you.
– Paul White♦
Aug 10 '18 at 20:36
Please edit your answer so it provides value if the link stops working. You can find guidance on how to do this correctly in How to reference material written by others. Thank you.
– Paul White♦
Aug 10 '18 at 20:36
add a comment |
It worked for me.
Change your postgresql directory according to version in your system.
Common path-
rm /usr/local/var/postgres/postmaster.pid
but for postgresql@9.6 in my system path is
rm /usr/local/var/postgresql@9.6/postmaster.pid
restart postgresql@9.6-
brew services restart postgresql@9.6
add a comment |
It worked for me.
Change your postgresql directory according to version in your system.
Common path-
rm /usr/local/var/postgres/postmaster.pid
but for postgresql@9.6 in my system path is
rm /usr/local/var/postgresql@9.6/postmaster.pid
restart postgresql@9.6-
brew services restart postgresql@9.6
add a comment |
It worked for me.
Change your postgresql directory according to version in your system.
Common path-
rm /usr/local/var/postgres/postmaster.pid
but for postgresql@9.6 in my system path is
rm /usr/local/var/postgresql@9.6/postmaster.pid
restart postgresql@9.6-
brew services restart postgresql@9.6
It worked for me.
Change your postgresql directory according to version in your system.
Common path-
rm /usr/local/var/postgres/postmaster.pid
but for postgresql@9.6 in my system path is
rm /usr/local/var/postgresql@9.6/postmaster.pid
restart postgresql@9.6-
brew services restart postgresql@9.6
answered Dec 3 '18 at 5:17
rahulworldrahulworld
111
111
add a comment |
add a comment |
The steps below helps me:
brew uninstall postgresql
brew install postgresql
brew postgresql-upgrade-database
New contributor
BMA88 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
The steps below helps me:
brew uninstall postgresql
brew install postgresql
brew postgresql-upgrade-database
New contributor
BMA88 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
The steps below helps me:
brew uninstall postgresql
brew install postgresql
brew postgresql-upgrade-database
New contributor
BMA88 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
The steps below helps me:
brew uninstall postgresql
brew install postgresql
brew postgresql-upgrade-database
New contributor
BMA88 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
BMA88 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 15 mins ago
BMA88BMA88
1
1
New contributor
BMA88 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
BMA88 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
BMA88 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f75214%2fpostgresql-not-running-on-mac%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown