I am new so apologies if this has been done to death in a former life.
Currently I am in the process of installing and configuring Homebrew:PostgreSQL after many years of “doing it my way”, and it has all worked just the way the documents said… well done and thank you.
Two items on which I would like to hear some thoughts:
While I am happy enough to accept “Sudo is bad” on basic principles, I find this hard to reconcile with the need to:
(a) install the file:homebrew.mxcl.postgresql.plist as a superuser owned item in /Library/LaunchDaemons so the postgres process will launch properly; and,
(b) have the whole PostgreSQL directory owned by the dedicated user, e.g., postgres, which is likely to not be the user doing the homebrew installation.
I would like for the versions of the installation to have a “Current” symlink in each place where a specific version could be reference, e.g.,
Current -> 9.6.1
Which would facilitate moving between different versions since the switch only has to be made in a single place provided other references are in sympathy, viz.,
brew -> /usr/local/Homebrew/bin/brew
clusterdb -> …/Cellar/postgresql/Current/bin/clusterdb
createdb -> …/Cellar/postgresql/Current/bin/createdb
My suggestion is for the installation script to determine if the user wants to install the PostgreSQL as a specific user (and do it) and ask further if the .plist is to be installed (and do it). The script would decline to act if the user is not an administrator with a suitable message. This approach would minimise the evil of sudo and still get a proper result. Is this being too controversial?
The “Current” symlink is a matter of taste but does fit with a long history of unix installed packages where versioning is supported and can be useful while still being “mostly harmless”. I hope others agree.