- Notifications
You must be signed in to change notification settings - Fork35
petere/homebrew-postgresql
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
These formulae allow installing multiple versions of PostgreSQL in parallel. This is similar to what you can do on certain Linux distributions, for example Debian.
To install something, firstbrew tap petere/postgresql
and thenbrew install <formula>
. Since there might be name overlaps with core Homebrew formulae, you should use fully qualified formula names likebrew install petere/postgresql/postgresql-common
.
Since PostgreSQL major releases have incompatible data directories and other occasional incompatibilities, it is useful for many developers to keep several major versions installed in parallel for development, testing, and production. So far, Homebrew had inconsistent support for that and did not provide the full range of supported major versions. This tap provides versioned formulae namedpostgresql@9.5
,postgresql@9.6
, etc. that you can install in parallel. Technically, these are "keg-only", which has the nice side effect that they are automatically installed in side-by-side directories/usr/local/opt/postgresql@9.6/
etc.
To use the programs installed by these formulae, do one or more of the following, in increasing order of preference:
- Call all programs explicitly with
/usr/local/opt/postgresql@9.6/bin/...
. This will be boring in the long run. - Add your preferred
/usr/local/opt/postgresql@x.y/bin
etc. to your path. Preferably to the front, to come before the operating system's PostgreSQL installation. This will work alright, but depending on your setup, it might be difficult to get everything on the OS to see the same path. brew link -f
thepostgresql@x.y
formula you prefer to use.- Install the
postgresql-common
package (see below).
The versioned formulae can be installed alongside the mainpostgresql
formula in Homebrew. But there will be a conflict if you dobrew link -f
or installpostgresql-common
, so in those cases you have to uninstall the mainpostgresql
package first. This is not a problem, however, because the versioned packages provide the same functionality.
The standardpostgresql
formula in Homebrew is missing a number of build options and also has a number of build options that I find useless. These formulae enable allconfigure
options that macOS can support, but also remove a number of Homebrew-level build options, to reduce complexity. I have also dropped supported for legacy macOS concerns, such as 32-bit Intel and PowerPC and really old macOS releases. Mainly because I can't test that anymore, YMMV.
I keep old and deprecated versions of PostgreSQL in this repository instead of removing them, because they are sometimes useful to have handy, and also for curiosity. But note that over time, the oldest versions will stop building and/or running on newer operating system versions. The PostgreSQL major versions that are still maintained upstream are expected to work, but anything beyond that is best-effort and YMMV.
postgresql-common
is a port of the postgresql-common package from Debian, which contains programs that help manage these multiple versioned installations, and programs to manage multiple PostgreSQL instances (clusters). The port a bit experimental, but it works.
See/usr/local/opt/postgresql-common/README.Debian
to get started. If you have used Debian or Ubuntu before, you'll feel right at home (I hope).
The general idea is that for server-side operations you use the special wrapper scriptspg_createcluster
,pg_dropcluster
,pg_ctlcluster
, andpg_lsclusters
instead ofinitdb
andpg_ctl
. The scripts take version numbers and instance names (which map to directory names). For example:
pg_createcluster 9.6 testpg_ctlcluster 9.6 test start
See the respective man pages for details.
For client-side operations, to usual tools such aspsql
andpg_dump
are wrapped to automatically use the right version for the instance they are connecting to, so you usually don't need to do anything special. See the man pagepg_wrapper
for details.
To install extensions, I recommendPex. It has support for multiplePostgreSQL installations and can easily support to the installationscheme used by these packages. Example:
pex -g /usr/local/opt/postgresql@9.6 install ip4r
About
🐘 PostgreSQL formulae for the Homebrew package manager
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors7
Uh oh!
There was an error while loading.Please reload this page.