Skip to content

Instantly share code, notes, and snippets.

@spidezad
Created December 3, 2019 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spidezad/0b94db32fbb40f98b5160dd2e4abd602 to your computer and use it in GitHub Desktop.
Save spidezad/0b94db32fbb40f98b5160dd2e4abd602 to your computer and use it in GitHub Desktop.
Installing Postgres on Mac
Ref: https://medium.com/@Umesh_Kafle/postgresql-and-postgis-installation-in-mac-os-87fa98a6814d
# Remove previous versions of PostgreSQL
brew uninstall --force postgresql
# Delete all Files of Postgres
rm -rf /usr/local/var/postgres
# Install Postgres with Homebrew
brew install postgres
# Install PostGIS with Homebrew
brew install postgis
# Start PostgreSQL server
pg_ctl -D /usr/local/var/postgres start
# initialize Database
initdb /usr/local/var/postgres
## IF ERROR
# Stop server
pg_ctl -D /usr/local/var/postgres stop
# Remove old database file
rm -r /usr/local/var/postgres
# start server again
pg_ctl -D /usr/local/var/postgres -l logfile start
# Run the initdb command again
initdb /usr/local/var/postgres
##
# Create a new database
createdb postgis_test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment