Homebrew postgres broken

brew install postgres
brew uninstall postgres
brew start postgres
error: no such file or directory @ rb_sysopen - /usr/local/var/postgres/pg_version
brew postgresql-upgrade-database
error: formula `postgresql` is not installed.
brew install postgres 11
postgresql not working on mac

I installed Postgresql 9.4.0 installed on my Mac (10.10.1/Yosemite) using homebrew. It does not work.

I have created the softlink to /usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist in ~/Library/LaunchAgents.

If I try to manually load postgres I get the message that the "Operation is in progress"

> launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
/usr/local/Cellar/postgresql/9.4.0/homebrew.mxcl.postgresql.plist: Operation already in progress

However postgres does not appear to be running.

> ps auxw | grep post
billmcn           670   0.0  0.0  2424272    452 s000  R+   10:12PM   0:00.01 grep post

and I cannot connect with the command line client.

> psql
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"?

To my knowledge I have tried all the fixes suggested on other Stackoverflow threads discussing this problem. Specifically:

  • I have uninstalled and reinstalled postgres and the accompanying Ruby gem. There is no postgres 8.0 version on my machine.
  • I have verified that the psql client program is the 9.4.0 version installed by Homebrew and not a Mac system binary.
  • I have verified that the /usr/local/var/postgres/postmaster.pid does not exist.
  • I have rebooted the machine.

I did have Homebrew postgres working on this machine earlier. I think what broke it is upgrading from version 8 to version 9 but I'm not sure.

I don't have any databases I need to preserve. I'm willing to start clean with postgres; I just need to get it to work now. Any ideas?


The issue appears to have been permissions on the /usr/local/var/postgres directory. Here is what my var directory looked like when things weren't working.

ll /usr/local/var/
drwxr-xr-x  3 billmcn  admin  102 Dec 20 12:44 cache
drwxr--r--  2 root     admin   68 Dec 29 21:37 postgres

(whoami = "billmcn")

I deleted /usr/local/var/postgres, uninstalled and reinstalled postgres, and now it looks like this.

ll /usr/local/var/
drwxr-xr-x   3 billmcn  admin  102 Dec 20 12:44 cache
drwx------  23 billmcn  admin  782 Dec 30 10:51 postgres

Not sure how it got into this state because I don't remember futzing with the permissions on this directory, but no matter. It works now.


I had the same problem installing postgres using homebrew on a freshly installed Yosemite.

First off my brew config looks like this:

HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: 9f6926265f8e4be7cc80dfe9042f2cd3c1e8dc9e
Last commit: 64 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit sandybridge
OS X: 10.10.1-x86_64
Xcode: 6.1.1
Clang: 6.0 build 600
X11: N/A
System Ruby: 2.0.0-481
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: ~/.rvm/rubies/ruby-2.1.1/bin/ruby

First thing i noticed was that I had no write permission to /usr/local/var/postgres. This was easily changed issuing sudo chown -R `whoami` /usr/local/var/postgres then I reinstalled postgresql and did

cat /usr/local/var/postgres/server.log

which revealed:

postgres cannot access the server configuration file "/usr/local/var/postgres/postgresql.conf": No such file or directory

So I removed the directory /usr/local/var/postgres and issued the command to initialize the database.

initdb -D /usr/local/var/postgres/

This seemed to have done the trick and postgres is running fine.

brew-postgresql-upgrade-database broken � Issue #40904 , brew-postgresql-upgrade-database broken #40904. Closed. woahdae opened this issue on Jun 11, 2019 � 0 comments. Closed� Homebrew postgres broken. Ask Question Asked 4 years, 11 months ago. Active 20 days ago. Viewed 36k times 64. 33. I installed Postgresql 9.4.0 installed on my Mac (10


I had this same problem. The primary issue here is that the initdb step of installation will create the directory with root ownership instead of as the user on a Mac. To solve this issue:

Create the data directory before running initdb and set permissions of 0700

rm -rf /usr/local/var/postgres  # in case this is not your first try
mkdir /usr/local/var/postgres
chmod 0700 /usr/local/var/postgres

Then run initdb and it will respect the permissions of the data directory.

initdb -D /usr/local/var/postgres

For grins and giggles, create a test db named after your user:

createdb `whoami`

Login to test:

psql

Installation is broken: default Homebrew postgresql now 11.1 � Issue , Similar to this issue from your Slack channel, the postgresql dependency in this formula breaks installation of timescaledb. Most unfortunately, I� macos - such - Homebrew postgres broken stop postgres mac (5) I installed Postgresql 9.4.0 installed on my Mac (10.10.1/Yosemite) using homebrew.


After trying to install postgresql with Homebrew, I got this:

Warning: postgresql-9.5.2 already installed, it's just not linked

So I tried:

brew link postgresql

And got this error:

Linking /usr/local/Cellar/postgresql/9.5.2... 
Error: Could not symlink share/man/man3/SPI_connect.3
/usr/local/share/man/man3 is not writable.

It seemed to be a write permission matter, so I did:

sudo chown -R `whoami` /usr/local/share/man/

It did the trick because, then I was able to do (without error):

brew link postgresql

Homebrew installed PostgreSQL could not connect, database files , If you don't have any data, then it seems like a problem with Brew. Did you run brew upgrade, there are two answers on StackOverflow that� The funny thing is, if I try to install the latest PostgreSQL I get: $ brew install postgresql Error: postgresql 9.5.5 is already installed To upgrade to 10.1, run `brew upgrade postgresql` So I'm not sure how you got from 9.6.x to 10.1 without seeing that message


Please note that their is a thread on Homebrew's github dealing with this issue: https://github.com/Homebrew/homebrew/issues/35240


I have had a similar issue. James answer helped me solve it. But I then ran into the issue jbk is mentioning (after having deleted /usr/local/var/postgres, it kept on being recreated).

The issue is that if you have created the symlink:

ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents

and launched the process:

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

you should first unload it:

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

before running James's commands.

rm -rf /usr/local/var/postgres  # in case this is not your first try
mkdir /usr/local/var/postgres
chmod 0700 /usr/local/var/postgres

In addition, if, like me, you have an admin user managing homebrew and a regular user who will be using pgsl for development purpose, James command should be run as super user:

sudo -s

and ownership over the postgres directory should be given to your dev user:

chown my-dev-user /usr/local/var/postgres

The following command, run as the dev user, should then properly populate the directory:

createdb `whoami`

Running:

psql -l

should show you the tables and user permissions in postgre after such manipulations.

Hope this helps.

Postgres on OSX with homebrew not running after OSX crash , postgres � homebrew. OSX Mavericks has been crashing randomly recent to me. Just very random. Not quite good because it doesn't give it the� I'm on a brew install postgresql@9.6 for legacy reasons, and actually needed to: # First, close all connections, e.g. application servers and psql connections, then brew services stop postgres killall postgres brew services start postgres


In case anyone upgraded from a previous version, dont forget to:

brew postgresql-upgrade-database

That will solve the problem by upgrading your existing databases to the version you upgraded postgres to.

Completely Uninstall and Reinstall PSQL on OSX, You just run a quick brew services restart postgresql and you should be Update Homebrew for posterity and then reinstall PostgreSQL� As each version is incompatible it would almost be better to have different formula for each version of Postgres and postgis combination. That way you would have to select to upgrade rather than being left with a broken system and a bunch of manual steps to revert back to include the correct extensions.


Migrating Homebrew Postgres to a New Version, In Homebrew 1.5 and above, there's a new process to upgrade your Postgres database across major versions using the brew postgresql-upgrade� Homebrew is a package manager for Mac OS X that builds software from its source code. It includes a version of PostgreSQL packaged by what it refers to as a formula. This type of installation might be preferred by people who are comfortable using the command line to install programs, such as software developers.


How can I remove Postgres completely from my Mac?, So however installed, I have a broken Postgres installation that I would like to wipe completely. How can I completely wipe Postgres from my system so I can install� * downgrade Postgres version to latest per-12 Currently, all post-12 versions have the following bug: petere/homebrew-postgresql#51 * allow user in test environment to manage databases The test local user must be owner of the test database in order to be able to drop it. They must be created the createdb privilege to be able to create a database.


"FATAL: lock file "postmaster.pid" already exists", If the pid is not that of a postgres postmaster, manually kill any postgres this to no avail after upgrading to Yosemite broke my postgres (installed via homebrew). Then just start postgres again using the normal homebrew launch sequence: postgresql. Also known as: postgres, To migrate existing data from a previous major version of PostgreSQL run: brew postgresql-upgrade-database: Analytics