What is PostgreSQL?
PostgreSQL is an open-source relational database management system (RDBMS) known for its reliability and scalability, which has made it a favorite among engineers worldwide. It features:
- Advanced query processing and ACID compliance
- Support for modern data types like JSON and GIS
- Commercial-grade performance and scalability for free
It’s widely used for web applications, business systems, and data analysis!
How to Install PostgreSQL on Mac【Homebrew Method】
🔧 Preparation: Install Homebrew
If you haven’t installed Homebrew yet, paste the following command in your terminal:
💡 Tip
Our guide on installing Git on Mac also covers this Homebrew installation method. If you’re planning to use Git, check it out as well!
🛠 “brew command not found”? Fix it with PATH settings!
If you encounter an error that the brew command is not available before installing PostgreSQL, Homebrew might not be properly added to your PATH.
You can fix this with the following steps 👇
✅ Step 1: Add Homebrew to PATH
If you’re using zsh (the default shell in macOS), run these commands in your terminal:
This will:
- Make Homebrew available in future terminal sessions (persistent)
- Make it immediately available in your current session
💡 Reference
Our guide on fixing the “claude command not found” issue also covers similar PATH settings. If you’re experiencing command not found errors, check out this article too!
✅ Step 2: Verify Installation
Check if Homebrew is available with this command:
If you see a version number like Homebrew 4.x.x, you’re good to go!
① Install PostgreSQL
Install PostgreSQL with this command:
② Start the Server
Start the PostgreSQL server with this command:
③ Verify Installation
Check if PostgreSQL is running by executing:
If successful, the PostgreSQL console will open. You can exit with \q.
🌟 Comfortable Database Management with GUI Tools
While “psql” is usable, GUI tools are more convenient for beginners.
🖥️ pgAdmin
The official GUI tool with rich features that also supports remote management.
Download: https://www.pgadmin.org/download/
🧊 Postico (Mac Only)
Lightweight with an intuitive UI. Perfect for local development.
Download: https://eggerapps.at/postico/
💡 Common Errors and Solutions
❌ psql: command not found
→ Add the following to your .zshrc or .zprofile and reload:
❌ Cannot connect (FATAL error)
→ The PostgreSQL server might not be running:
✨ Personal Take: PostgreSQL is Worth the Investment!
Compared to MySQL or SQLite, PostgreSQL has a bit of a “professional” feel. However, once you learn it properly, it becomes a reliable foundation for services of any scale.
Setting up a local environment lets you practice everything from SQL queries to testing connections with web frameworks like Rails or Django!
📚 Related Articles
We have more helpful resources for Mac users. Check these out:
🚀 Summary: PostgreSQL is Easy to Use on Mac!
Installing PostgreSQL with Homebrew and GUI tools can be done by anyone in just 10 minutes. Use this guide to start your local database development journey!
🔗 References
- PostgreSQL Official Website: https://www.postgresql.org/
- Homebrew Official Documentation: https://brew.sh/
Leave a Reply