

When you run this, you should see arm files getting downloaded. The newest version of Homebrew has been built natively for the M1 Architecture. Installing it won’t hurt anything and you’ll definitely need it for this guide. Homebrew is a package manager that every MacOS user should have.
#Install postgresql mac m1 brew install#
Setupīefore starting you need to install XCode for the command line tools. Credit goes to the original author: Kevin Dees. Here, I’ve pared it down and fixed the relevant content. Note: Most of this content originated from this post. Once I created the directory manually and chown'd it, things started to work as they should.This guide will walk you through installing and configuring nginx, PHP and Mysql optimized for MacOS Big Sur on Apple Silicon - M1 Arm processors. Then I could get back into Rails-world and migrate the DB properly - I surmise that this means the homebrew installation step (perhaps the postinstall step that kept failing) wasn't creating the /usr/local/var/postgres directory as it should have, or it was trying with insufficient permissions to do so and failing silently.

=> Successfully started `postgresql` (label: ) => Successfully stopped `postgresql` (label: ) Pg_ctl -D /usr/local/var/postgres -l logfile start You can now start the database server using: auth-local and -auth-host, the next time you run initdb. You can change this by editing pg_hba.conf or using the option -A, or Initdb: warning: enabling "trust" authentication for local connections Performing post-bootstrap initialization. Selecting dynamic shared memory implementation. The default text search configuration will be set to "english".įixing permissions on existing directory /usr/local/var/postgres. The default database encoding has accordingly been set to "UTF8". The database cluster will be initialized with locale "en_US.UTF-8". This user must also own the server process. The files belonging to this database system will be owned by user "tyler". ➜ ~ sudo chown -R `whoami` /usr/local/var/postgres I've run these steps and postgresql has started working - I'll admit that this is a case of "better lucky than good" because I was just stabbing in the dark here - ➜ ~ sudo mkdir /usr/local/var/postgres Why does homebrew suggest running pg_ctl from /usr/local/var but postgres process does not exist here after fresh install? Why do I find it in /usr/local/bin ? Then when I try to launch from bin/ it's asking for the postmaster.pid file in bin/ but of course there is no postgres directory in bin/ as these are the processes themselves. Mkdir: /usr/local/bin/postgres: File exists Pg_ctl: could not open PID file "/usr/local/bin/postgres/postmaster.pid": Not a directory ➜ ~ pg_ctl -D /usr/local/bin/postgres start Pg_ctl: directory "/usr/local/var/postgres" does not exist UPDATE: it's starting to feel like /usr/local/var and /usr/local/bin have gotten confused by either me, homebrew, or the postgres cask because the error messages don't match the reality: ➜ ~ pg_ctl -D /usr/local/var/postgres start You can try again using `brew postinstall ideas?

➜ ~ brew postinstall Postinstalling The post-install step did not complete successfully You can try again using `brew postinstall postgresql` Warning: The post-install step did not complete successfully The only answer says "I ran the install script on the old installation" which means nothing to me - I tried brew postinstall imagining this to be what is meant by the "old installation" but I get the exact same result: ➜ ~ brew postinstall postgresql I have exactly the issue reported here. Or, if you don't want/need a background service you can just run: To have launchd start postgresql now and restart at login: Initdb -locale=C -E UTF-8 /usr/local/var/postgres This formula has created a default database cluster with: To migrate existing data from a previous major version of PostgreSQL run: Not any longer - there is something out of whack and I don't know how homebrew works well enough to troubleshoot this. I've had instances with this machine where I see "Mac OSX restarted due to a problem" and usually there is a stale postmaster.pid file that I can delete and restart postgresql and everything is fine.

I've never had an issue like this before - normally brew install postgres works and everything is fine.
