Skip to content

Instantly share code, notes, and snippets.

@ercansormaz
Last active October 26, 2025 12:56
Show Gist options
  • Select an option

  • Save ercansormaz/5e4073b77ee82bc39338059d4cef3348 to your computer and use it in GitHub Desktop.

Select an option

Save ercansormaz/5e4073b77ee82bc39338059d4cef3348 to your computer and use it in GitHub Desktop.
PostgreSQL Installation on macOS (Homebrew)

👉 Read the Blog Post

# Install PostgreSQL 18
brew install postgresql@18

# Remove default cluster
# For ARM64 (Apple Silicon)
rm -rf /opt/homebrew/var/postgresql@18

# For Intel
rm -rf /usr/local/var/postgresql@18

# Initialize new cluster with custom user/password
# For ARM64
/opt/homebrew/opt/postgresql@18/bin/initdb -D /opt/homebrew/var/postgresql@18 -U postgres -W --locale=en_US.UTF-8 -E UTF8 -A scram-sha-256

# For Intel
/usr/local/opt/postgresql@18/bin/initdb -D /usr/local/var/postgresql@18 -U postgres -W --locale=en_US.UTF-8 -E UTF8 -A scram-sha-256

# Start PostgreSQL manually
brew services run postgresql@18

# Stop PostgreSQL
brew services stop postgresql@18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment