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. For installing elsewise in OS X see here.
Typical installation of server looks like
$ brew install postgresql
This installs the command line console (psql) as well as a PostgreSQL server locally, so you can create your own databases locally if desired. If you want just the command line console (psql) to access remote databases, see here.
It will give you instructions on creating an initial database. When you do it will be "owned" by your username and create the `postgres` and `template1` databases.
Run the following to start the server.
$ brew services start postgresql # or "brew services run postgresql" to have it not restart at boot time # or the pg_ctl command it mentions
And to connect/use it, as your user:
$ psql postgres
You can see what other versions are available for install by running
$ brew search postgres ==> Formulae check_postgres postgresql ✔ postgresql@10 postgresql@11 ...
You can see which version the current latest is/will be by installing it and inferring it from the directory, running `brew info postgresql` or looking at the formula `brew edit postgresql`
Notes on Homebrew:
- Install PostgreSQL on Mac OS X via Brew
- Brew Install Postgresql on OS X Lion - Resolving conflicts with the built-in PostgreSQL libraries shipping with OS X 10.7 'Lion'
- Discussion comparing Homebrew and EDB OS X installers
petere/postgresqltap for installing multiple PostgreSQL versions in parallel