Note
brew will probably install the latest version of postgresql, but it's preferable to have the same version as on production to avoid issues with syntax incompatibility. Current version on the production server is 9.3.
Procedure for Mac/Linux
From the Terminal app:
brew install postgresql
brew services start postgresql
createdb USERNAME
psql
Troubleshooting. In some cases, there is might be an issue when starting postgresql:
sh: 1: list: not found
Error: Failure while executing:
load -w /home/user/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
This is a known issue and it can be solved using this solution.
Procedure for Windows
Download and run the Windows installer.
Choose the default locations for program and data files.
Choose the default port number.
After installation is complete, open Windows Services and verify that the PostgreSQL service is running.
Use pgAdmin to connect to the database server and verify its operation.