How to install PostgreSQL on Windows
To install Postgres on Windows, the PostgreSQL project points to one installer, built by EDB: it puts the server, pgAdmin and the command-line tools on your PC in one go. This guide is for PostgreSQL 18 on Windows 11 and Windows 10, 64-bit. It also covers the psql command, pgAdmin and the errors people search for most.
Download the installer
Open postgresql.org/download/windows and follow Download the installer. It leads to EDB’s download page. In the row of the newest stable version (18 at the moment), click the download for Windows x86-64. A version marked beta or RC is a test release, skip it.
The installer is the only file you need. Take it from that page and not from other sites: it is the build the PostgreSQL project links to.
How to install PostgreSQL on Windows
- Run
postgresql-18.…-windows-x64.exeand allow it to make changes. Keep the Installation Directory,C:\Program Files\PostgreSQL\18. - Select Components: keep PostgreSQL Server, pgAdmin 4 and Command Line Tools. Stack Builder only downloads add-ons, you can untick it.

- Data Directory: keep the default
C:\Program Files\PostgreSQL\18\dataor choose a folder on a fast disk. - Password: type a password for the
postgressuperuser and retype it. Use your own strong password and keep it: there is no other way in at first. - Port: keep
5432. If another PostgreSQL already holds it, the installer offers the next free one, such as5433. - Advanced Options: Default locale takes the language of your Windows. Keep it unless your project needs another one.
- Click Next on Pre Installation Summary and Ready to Install. On the last page untick Stack Builder if you don’t need add-ons and click Finish.
With winget in Terminal as administrator, the same installer opens with its wizard:
winget install --id PostgreSQL.PostgreSQL.18 -e --interactivePostgreSQL runs as a Windows service named postgresql-x64-18 and starts with Windows.
Use psql in Terminal
The installer doesn’t change PATH, so a new Terminal doesn’t know psql yet. Add the folder once:
- Open Start, type “environment” and choose Edit the system environment variables. Click Environment Variables.
- Under System variables select Path, click Edit, then New, and paste
C:\Program Files\PostgreSQL\18\bin. Click OK in every window. - Close Terminal and open it again.
Now sign in as postgres. Give the user name every time: on Windows psql otherwise takes your Windows account name. It asks for the password from the installer and prints the server version.
psql --version
psql -U postgres -c "SELECT version();"For a project, create its own user and database instead of working as postgres. Change the names and the password to your own:
psql -U postgres -c "CREATE USER app WITH PASSWORD 'choose-a-strong-password';"
psql -U postgres -c "CREATE DATABASE app OWNER app;"Open the server in pgAdmin
pgAdmin 4 is in the Start menu. It opens in its own window. In the tree on the left, open Servers and then the server the installer added, PostgreSQL 18, and type the postgres password. From there you can browse databases and tables and run queries in Query Tool.
If PostgreSQL doesn’t install or connect
'psql' is not recognized as an internal or external command, operable program or batch file(in PowerShell:The term 'psql' is not recognized): thebinfolder is not inPATH. Add it as above and open a new Terminal.password authentication failed for user "postgres": the password is wrong. If the message names your Windows account instead ofpostgres, you forgot-U postgres.Connection refused (0x0000274D/10061)andIs the server running on that host and accepting TCP/IP connections?: the service is stopped. Start it in the Services app, or in Terminal as administrator. Check it:Get-Service postgresql*Then start it:Start-Service postgresql-x64-18Also check the port if you chose another one:psql -U postgres -p 5433Problem running post-install steporThe database cluster initialisation failed: EDB says the installer doesn’t handle some non-Latin characters in user names, computer names and paths. Run it again and choose a data folder with Latin letters only, such asC:\PostgreSQL\18\data. Details are ininstall-postgresql.login the%TEMP%folder.WARNING: Console code page (437) differs from Windows code page (1252): letters outside English may show wrong inpsql. The psql manual says to set the font to Lucida Console and to switch the console to the Windows code page from the message:chcp 1252
If you also work on a Mac

System Junk in MacWashing finds the caches of every app it knows, including those hidden inside app data, plus logs, Xcode junk and leftovers of deleted apps. It shows how much each takes and clears them in one go. Anything debatable stays unchecked until you decide.
Free trial · macOS 14 or later
Questions and answers
How do I install Postgres on Windows 11?
Download the EDB installer linked from postgresql.org/download/windows, run it, set the postgres password and keep port 5432. Add C:\Program Files\PostgreSQL\18\bin to PATH to use psql.
Do I need Stack Builder?
No. It is a separate tool that downloads add-ons such as drivers and PostGIS. The server, pgAdmin and psql work without it, and you can run it later from the Start menu.
Where are the PostgreSQL settings on Windows?
In the data folder, C:\Program Files\PostgreSQL\18\data by default: postgresql.conf for the server and pg_hba.conf for who may connect. Restart the postgresql-x64-18 service after a change.