Managing multiple PostgreSQL installs via Homebrew

Reading time ~1 minute

Following on from this post, you probably have multiple versions of PostgreSQL installed on your Mac. In that post, I added an example function to help you manage all these concurrent installs. Today, I’m back with a full-fledged shell script to help manage all this. Without further ado, the script:

But what does it do? It’s pretty simple actually. When you call this script, you tell it what version of PostgreSQL you want:

doug@Douglass-MacBook-Pro ~ » pg 9.6

and then the script does the following:

  • checks if the requested version is installed, and installs it if not
  • checks if another version of PostgreSQL is running, and stops it
  • checks if another version is linked as the active version, and unlinks it
  • links the requested version as the active version
  • sets PGDATA to point to the requested version’s data cluster
  • does an initdb for the requested version if needed
  • starts the requested version’s cluster

I’ll be the first to admit that the script could use additional work, but it’s functional enough to start using today. As I continue to improve the script, I’ll update the gist with those changes, so check back every so often.

Enjoy.

pgBackRest 2.08 and macOS Mojave

UPDATE: My reasoning was incorrect below. It wasn't the moving of some of the lock code to C that caused the issue. It was moving `-D_POS...… Continue reading

pgBackRest 2.07 and macOS Mojave

Published on November 16, 2018

Monitoring pgBackRest with tail_n_mail

Published on September 24, 2018