← MacSELECT * FROM Shiraverse · All Nukte
Get startedSetupMac › One-command install

Install PostgreSQL on Mac with one command

One Terminal command installs everything you need for this course: PostgreSQL, pgAdmin 4, VS Code and Git. Then you check that it worked. About 20 to 30 minutes, mostly waiting. No experience needed.

Jo video mein bola, yahan nukte mein likha hai.
What I said in the video, written here as key points.

▶ Watch the video

Mac › One-command

One command. Four tools.

PostgreSQL logo
PostgreSQLthe database engine
🖥️
pgAdmin 4see your data visually
📝
VS Codewrite your SQL files
🌿
Gitsave your work

Ek command, saara setup. One command sets up your Mac.

This is the fast way to set up your Mac. One script installs the four tools we use: PostgreSQL (the database engine), pgAdmin 4 (a visual manager), VS Code (an editor for .sql files) and Git (version control). It also creates an empty database called practice for your own tables.

Before you start

Three things you need

Thoda sabr rakhna. About 20 to 30 minutes, mostly waiting.

You need a Mac, an internet connection, and your Mac login password. The script installs Homebrew first if you do not have it. Homebrew is a free tool that installs Mac software from Terminal. Plan for about 20 to 30 minutes, most of it waiting for downloads.

Step 1 of 3

Download the installer

📄
install_mac.shfrom sql.theshiraverse.com/setup
📁
Downloadskeep it there, we run it from that folder

Pehle file utaaro. First, get the file onto your Mac.

Download install_mac.sh and leave it in your Downloads folder. It is a plain text script, so you can open it in TextEdit and read exactly what it does. The installer files are also on the Setup page.

Step 2 of 3

Open Terminal

1
Press Cmd + SpaceSpotlight opens
2
Type "Terminal"the black-and-white icon
3
Press Returna window opens
4
That is allno admin mode needed

Mac mein admin mode alag nahi hota. On Mac there is no separate admin window.

Press Cmd + Space, type Terminal, and press Return. A window opens with a prompt. Unlike Windows, you do not need a special administrator window. The script asks for your Mac password when it needs it.

Step 3 of 3

Type three lines

Terminal– □ ×
~ % cd ~/Downloads ~ % chmod +x install_mac.sh ~ % bash install_mac.sh
cd ~/DownloadsGo to the folder where the file is.
chmod +x install_mac.shAllow the file to run.
bash install_mac.shStart the installer. Then wait.

Bas teen line. Just three lines. Press Return after each one.

In Terminal, type these three lines, pressing Return after each:

cd ~/Downloads
chmod +x install_mac.sh
bash install_mac.sh

If Homebrew is being installed, it asks for your Mac password. Nothing appears as you type it. That is normal. Type it and press Return. It may also say "Press RETURN to continue". Press Return.

While you wait

What the script is doing

Let it finish. Wait until you see Installation Complete!

While it runs, the script installs Homebrew if missing, installs PostgreSQL, links psql onto your PATH, starts the database and waits for it, creates the postgres user and an empty practice database, then installs pgAdmin 4, VS Code and Git. Anything you already have is skipped. Wait until you see "Installation Complete!"

At the end

Your connection details

Hostlocalhost
Port5432
Userpostgres
Passwordpostgres
Databasepractice

Yeh sirf practice ke liye hai. This simple password is for practice on your own Mac only.

At the end the script prints these details. Save a screenshot. The password postgres is fine for practice on your own laptop. Want your own? Before you run the script, type export PG_PASSWORD="your-password" in the same Terminal window.

Check it worked

Close it. Open a new one.

Terminal– □ ×
~ % psql --version psql (PostgreSQL) <version> ~ % git --version git version 2.x ~ % code --version 1.x.x ~ % psql -h localhost -U postgres -d practice Password for user postgres: practice=#

See practice=#? You are connected. Type \q to leave. Mubarak ho!

Close Terminal and open a new window, so the PATH changes take effect.

psql --version
git --version
code --version
psql -h localhost -U postgres -d practice

The first three should print version numbers. The last asks for your password (postgres unless you changed it) and shows practice=#. Type \q to leave. Then open pgAdmin 4 from Applications and check it connects.

If something goes wrong

Common problems

brew: command not foundOpen a new Terminal window. Still no? Run the Homebrew install step again.
psql: command not foundOpen a new Terminal window. Still no? Run brew link --force postgresql@<version>.
PostgreSQL will not startRun brew services list, then brew services restart postgresql@<version>.
code: command not foundOpen VS Code, press Cmd + Shift + P, run Shell Command: Install 'code' command in PATH.

Tell me exactly what the screen says. Ghabrana nahi.

  • brew: command not found: open a new Terminal window. Still no? Run the Homebrew install step again.
  • psql: command not found: open a new Terminal window. Still no? Run brew link --force postgresql@<version>.
  • PostgreSQL will not start: run brew services list, then brew services restart postgresql@<version>.
  • code: command not found: open VS Code, press Cmd + Shift + P and run Shell Command: Install 'code' command in PATH.

Tip: always restart Terminal after installing, so PATH changes take effect.

Your turn

Did you see practice=#?

sql.theshiraverse.com

Tell me in the comments. Milte hain agli video mein. Next: load the RetailMart database.

Free SQL course and the Setup page, which maps every step. Join the WhatsApp Community, the Channel or Discord.

→ / Space next   ← back   F fullscreen   H hide bars   N notes