Fastest path: run Postgres 18 with pgvector in Docker, then enable the extension. On Ubuntu or Debian, use the PGDG apt repository and install postgresql-18-pgvector. On Windows, use Docker Desktop unless you need a native install.
docker run -d -e POSTGRES_PASSWORD=secret -p 5432:5432 pgvector/pgvector:pg18-trixie
psql -h localhost -U postgres -c "CREATE EXTENSION vector;"Choose your platform#
Each tab is a complete path from nothing to a working vector type. Your choice is remembered on the other install pages.
docker run -d --name pgvector \
-e POSTGRES_PASSWORD=secret \
-p 5432:5432 \
-v pgdata:/var/lib/postgresql \
pgvector/pgvector:pg18-trixiedocker exec -it pgvector psql -U postgres -c "CREATE EXTENSION vector;" \
-c "SELECT extversion FROM pg_extension WHERE extname = 'vector';"The volume path is /var/lib/postgresql for Postgres 18 images and /var/lib/postgresql/data for 17 and older — details below. Need another version, Compose, or a pinned tag? Use the Docker command builder.
sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
sudo apt install -y postgresql-18 postgresql-18-pgvectorReplace 18 with your Postgres major. These are exactly the commands we ran to build this site's test server on Ubuntu 24.04; afterwards apt reported:
postgresql-18-pgvector:
Installed: 0.8.7-1.pgdg24.04+1
Candidate: 0.8.7-1.pgdg24.04+1Skip the distro package. Without PGDG, apt install gives you Ubuntu 24.04's pgvector 0.6.0 or Debian 13's 0.8.0 — missing iterative index scans, and several index-corruption and buffer-overflow fixes from 0.8.2–0.8.7.
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf -qy module disable postgresql
sudo dnf install -y postgresql18-server pgvector_18PGDG publishes pgvector_18 0.8.7 for Postgres 14–18 on EL 9 and for 17–18 on EL 10. There are no yum packages for Postgres 13 any more. For EL 10, change EL-9 to EL-10 in the URL.
brew install postgresql@18 pgvector
brew services start postgresql@18
"$(brew --prefix postgresql@18)/bin/psql" postgres -c "CREATE EXTENSION vector;"Homebrew's pgvector formula (0.8.7) is built only for postgresql@17 and postgresql@18. Using Postgres.app? pgvector is already bundled — the current stable release (2.9.6) ships 0.8.6 for Postgres 15–18 — so just run CREATE EXTENSION vector;. Using the EDB installer? Build from source with PG_CONFIG=/Library/PostgreSQL/18/bin/pg_config.
Easiest: install Docker Desktop and use the Docker tab. Native Postgres from the EDB installer: pgvector is not included, so build it — open x64 Native Tools Command Prompt for VS as administrator and run:
set "PGROOT=C:\Program Files\PostgreSQL\18"
cd %TEMP%
git clone --branch v0.8.7 https://github.com/pgvector/pgvector.git
cd pgvector
nmake /F Makefile.win
nmake /F Makefile.win installThen CREATE EXTENSION vector; in psql or pgAdmin. Full walkthrough, build errors and alternatives in the Windows section.
cd /tmp
git clone --branch v0.8.7 https://github.com/pgvector/pgvector.git
cd pgvector
make
make install # may need sudoNeeds a C compiler and the Postgres server headers (postgresql-server-dev-18 on Debian/Ubuntu). See building from source for multiple Postgres installs and the OPTFLAGS="" portability flag.
Every major managed Postgres has pgvector available; you only enable it. On most providers that's one statement:
CREATE EXTENSION IF NOT EXISTS vector;Azure requires allow-listing first, and versions vary a lot between providers (RDS documents 0.8.2, Cloud SQL 0.8.5). See the provider table.
Which channels actually ship 0.8.7?#
pgvector 0.8.7 was released on 2026-10-01. Packaging channels catch up at different speeds, and the gap matters: 0.8.2 fixed a buffer overflow in parallel HNSW builds, 0.8.3 fixed possible HNSW index corruption during vacuum, and 0.8.4–0.8.7 fixed further vacuum and IVFFlat memory bugs (full history). We checked each channel's own package index on 2026-10-27:
| Channel | pgvector version | Postgres majors | Verdict |
|---|---|---|---|
Docker pgvector/pgvector | 0.8.7 | 13–18 (amd64, arm64) | ✅ Current |
PGDG apt (postgresql-NN-pgvector) | 0.8.7 | 13–19 (Debian 13); 16–19 checked on Debian 12, Ubuntu 24.04 | ✅ Current |
PGDG yum/dnf (pgvector_NN) | 0.8.7 | 14–18 (EL 9); 17–18 (EL 10) | ✅ Current |
Homebrew pgvector | 0.8.7 | 17, 18 | ✅ Current |
PGXN vector | 0.8.7 | 13+ (builds from source) | ✅ Current |
| FreeBSD ports / quarterly | 0.8.7 / 0.8.2 | — | ⚠️ Quarterly lags |
| Postgres.app 2.9.6 (macOS) | 0.8.6 | 15–18 | ⚠️ One behind |
| conda-forge | 0.8.6 | 18 (Linux/macOS), 16 only on Windows | ⚠️ One behind |
| Unofficial Windows DLLs (andreiramani) | 0.8.7 | 13–18 | ⚠️ Community build |
Alpine postgresql-pgvector | 0.8.1 | — | ❌ Old (edge and 3.24) |
| Debian 13 archive | 0.8.0 | 17 | ❌ Old — use PGDG |
| Ubuntu 24.04 archive | 0.6.0 | 16 | ❌ Very old — use PGDG |
Sources: Docker Hub tag API, apt.postgresql.org and download.postgresql.org package indexes, formulae.brew.sh, api.pgxn.org, freshports.org, the Postgres.app 2.9.6 build makefiles, api.anaconda.org, pkgs.alpinelinux.org, sources.debian.org and Launchpad.
Download pgvector#
There is no installer or binary download from the pgvector project. What you "download" depends on your platform:
- Source code: every release is a git tag —
git clone --branch v0.8.7 https://github.com/pgvector/pgvector.git, or a source tarball from github.com/pgvector/pgvector/tags and PGXN. - Prebuilt for Linux: packages from the PGDG apt and yum repositories (below).
- Prebuilt container:
docker pull pgvector/pgvector:pg18-trixie. - Windows: no official binaries — see your options.
Docker#
The pgvector/pgvector images are the official postgres images with pgvector compiled in (the Dockerfile is FROM postgres:$PG_MAJOR-$DEBIAN_CODENAME), so every POSTGRES_* variable and init-script convention works the same way.
Which tag should I use?#
| Tag pattern | Example | Base OS | pgvector version |
|---|---|---|---|
pgNN-trixie | pg18-trixie | Debian 13 | Floating — moves to each new release |
pgNN-bookworm | pg18-bookworm | Debian 12 | Floating |
pgNN | pg18 | Debian 12 (alias of bookworm) | Floating |
X.Y.Z-pgNN-trixie | 0.8.7-pg18-trixie | Debian 13 | Pinned to 0.8.7 |
Podman runs the same images; use the fully qualified name, docker.io/pgvector/pgvector:pg18-trixie, if your registries config doesn't search Docker Hub by default.
There is no latest tag and no Alpine variant. Compressed images are about 160–170 MB for current majors on both amd64 and arm64. For production, pin the pgvector version (0.8.7-pg18-trixie) so an image pull never changes your extension version underneath you.
The Postgres 18 volume path change#
Data loss trap. Postgres 18 images moved PGDATA to /var/lib/postgresql/18/docker and declare the volume at /var/lib/postgresql. Copying an old Compose file that mounts /var/lib/postgresql/data onto a pg18 image means your data lives in an anonymous volume and disappears with the container. On 17 and older, the reverse is true: mount /var/lib/postgresql/data.
Docker command builder#
Pick a version and options; the builder emits a docker run command and an equivalent compose.yaml with the right volume path and shared-memory size.
Adding pgvector to your own image#
If you already maintain a Dockerfile on the official postgres image, add the PGDG package instead of switching base images (the official image already has the PGDG apt repository configured):
FROM postgres:18-trixie
RUN apt-get update \
&& apt-get install -y --no-install-recommends postgresql-18-pgvector \
&& rm -rf /var/lib/apt/lists/*Linux packages#
On Debian, Ubuntu, RHEL and derivatives the reliable source is the PostgreSQL Global Development Group (PGDG) repository — the same people who package Postgres itself. On 2026-10-27 it had 0.8.7 for every supported Postgres major we checked. Commands are in the platform tabs above. Package names:
| Distribution | Package | Version on 2026-10-27 |
|---|---|---|
| Debian / Ubuntu (PGDG) | postgresql-18-pgvector | 0.8.7 |
| RHEL / Rocky / Alma / Fedora (PGDG) | pgvector_18 | 0.8.7 |
| FreeBSD | postgresql18-pgvector | 0.8.7 (ports), 0.8.2 (quarterly) |
| Alpine | postgresql-pgvector | 0.8.1 |
| Any (conda) | conda install -c conda-forge pgvector | 0.8.6 |
macOS#
Homebrew is the quickest route if you run Postgres from Homebrew: brew install pgvector installs into both postgresql@17 and postgresql@18. Prebuilt bottles are listed for Apple Silicon only, so on Intel Macs Homebrew compiles it. The formula only adds pgvector to postgresql@17 and postgresql@18; for an older formula such as postgresql@16, build from source with that formula's pg_config.
Postgres.app bundles pgvector for Postgres 15 and newer, so there is nothing to install: connect and run CREATE EXTENSION vector;. The stable release (2.9.6) ships pgvector 0.8.6; the 3.0 beta ships 0.8.7.
EDB installer: build from source and point at its pg_config:
export PG_CONFIG=/Library/PostgreSQL/18/bin/pg_config
cd /tmp && git clone --branch v0.8.7 https://github.com/pgvector/pgvector.git && cd pgvector
make
sudo --preserve-env=PG_CONFIG make installWindows#
pgvector has no official Windows installer. You have four realistic options:
| Option | Best for | pgvector version | Effort |
|---|---|---|---|
| Docker Desktop | Local development | 0.8.7 | Lowest — one command |
| Build with nmake | Native Postgres from the EDB installer | Any (you choose the tag) | Needs Visual Studio C++ tools |
| WSL 2 + Ubuntu | Linux-like dev environment | 0.8.7 via PGDG | Follow the Ubuntu steps inside WSL |
| Unofficial prebuilt DLLs | No compiler available | 0.8.7 (PG 13–18) | Copy files — but unofficial |
Two things that do not work, despite what older tutorials say: the EDB installer and StackBuilder do not include pgvector (we checked the 17.11 and 18.6 Windows binary distributions — neither contains vector.dll), and conda-forge's Windows build targets Postgres 16 only.
Building with nmake, step by step#
- Install the compiler. Install Visual Studio 2022 Build Tools (or Community) with the Desktop development with C++ workload. You also need Git for Windows.
- Open the right prompt. Start menu → x64 Native Tools Command Prompt for VS 2022 → right-click → Run as administrator. The plain Command Prompt or the x86 prompt will not work.
- Point at your Postgres.
set "PGROOT=C:\Program Files\PostgreSQL\18"— adjust the major version to match your install. - Build and install. Clone the
v0.8.7tag and runnmake /F Makefile.winthennmake /F Makefile.win install(commands in the Windows tab). The install step copiesvector.dllintoliband the SQL/control files intoshare\extension. - Enable it. In psql or pgAdmin's Query Tool:
CREATE EXTENSION vector;
Windows build errors#
| Error | Cause and fix |
|---|---|
Cannot open include file: 'postgres.h' | PGROOT is wrong or unset. Check the path contains include\server. |
error C2196: case value '4' already used | You're in a 32-bit prompt. Use the x64 Native Tools prompt, then nmake /F Makefile.win clean and rebuild. |
unresolved external symbol float_to_shortest_decimal_bufn | Postgres 17.0–17.2 on Windows. Upgrade Postgres to 17.3 or later. |
Access is denied during install | The prompt is not elevated. Re-open it with Run as administrator. |
Building from source (Linux and macOS)#
Building from source gets you any version on any platform with a C compiler. You need the server development headers: postgresql-server-dev-18 on Debian/Ubuntu, postgresql18-devel on PGDG RHEL.
- Several Postgres installs?
makebuilds against whicheverpg_configis first on yourPATH. Setexport PG_CONFIG=/usr/lib/postgresql/18/bin/pg_configexplicitly, runmake clean, and usesudo --preserve-env=PG_CONFIG make install. - Building on one machine, running on another? pgvector compiles with
-march=nativeby default on some platforms, which can crash withIllegal instructionon a different CPU. Usemake OPTFLAGS=""— the official Docker images do exactly this.
Managed Postgres providers#
You can't install extensions on managed services, but pgvector is pre-installed nearly everywhere. The version is whatever the provider ships — and most lag well behind 0.8.7. Documented versions on 2026-10-27:
| Provider | Newest documented pgvector | How to enable |
|---|---|---|
| Amazon RDS for PostgreSQL | 0.8.2 (PG 14–18); 0.8.0 on PG 13 | CREATE EXTENSION vector; |
| Amazon Aurora PostgreSQL | 0.8.2 (latest minors of 14–18) | CREATE EXTENSION vector; |
| Google Cloud SQL | 0.8.5 (PG 13+) | CREATE EXTENSION vector; |
| Google AlloyDB | 0.8.5.google-1 | CREATE EXTENSION vector; (as alloydbsuperuser) |
| Azure Database for PostgreSQL | 0.8.2 (PG 13–18) | Allow-list vector in the azure.extensions server parameter first, then CREATE EXTENSION vector; |
| Neon | 0.8.6 (PG 18); 0.8.0 (PG 14–17) | CREATE EXTENSION vector; |
| Supabase | Not stated in docs | Dashboard → Database → Extensions, or create extension vector with schema extensions; |
| Tiger Cloud (Timescale) | Not stated | CREATE EXTENSION vector; (not enabled by default) |
| DigitalOcean | Not stated | CREATE EXTENSION vector; (pre-installed on Advanced Edition) |
| Crunchy Bridge, Heroku, Render | Not stated | CREATE EXTENSION vector; |
az postgres flexible-server parameter set \
--resource-group my-rg --server-name my-server \
--name azure.extensions --value "vector"On a managed service, SELECT default_version FROM pg_available_extensions WHERE name = 'vector'; tells you what the provider has made available; if it's newer than your extversion, run ALTER EXTENSION vector UPDATE;. More provider detail on the ecosystem page.
Enable and verify#
Installing puts files on the server; enabling registers the extension in one database. Run this in every database that needs vectors — from psql, pgAdmin's Query Tool, DBeaver's SQL editor or any other client:
demo=# CREATE EXTENSION IF NOT EXISTS vector;
CREATE EXTENSION
demo=# SELECT extversion FROM pg_extension WHERE extname = 'vector';
extversion
------------
0.8.7
(1 row)To see what's installed on the server versus enabled in this database — useful after an upgrade:
demo=# SELECT name, default_version, installed_version FROM pg_available_extensions WHERE name = 'vector';
name | default_version | installed_version
--------+-----------------+-------------------
vector | 0.8.7 | 0.8.7
(1 row)Then a 10-second smoke test that the type and an index both work:
CREATE TABLE smoke (id bigserial PRIMARY KEY, embedding vector(3));
INSERT INTO smoke (embedding) VALUES ('[1,2,3]'), ('[4,5,6]');
CREATE INDEX ON smoke USING hnsw (embedding vector_l2_ops);
SELECT id, embedding <-> '[3,1,2]' AS distance FROM smoke ORDER BY distance LIMIT 1;
DROP TABLE smoke;Ready for real data? The quickstart walks through storing embeddings, and the index planner sizes your first index.
If CREATE EXTENSION fails#
These are the three errors people actually hit, captured from real sessions.
extension "vector" is not available#
The package isn't installed for this Postgres server. Here's PostgreSQL 16 on our test machine, where only the 18 package was installed:
ERROR: extension "vector" is not available
DETAIL: Could not open extension control file "/usr/share/postgresql/16/extension/vector.control": No such file or directory.
HINT: The extension must first be installed on the system where PostgreSQL is running.Install the package that matches the server's major version (check with SHOW server_version;). The most common cause is two Postgres installs — the package went into one, your client is connected to the other. In Docker, it means you're running postgres rather than pgvector/pgvector.
permission denied to create extension "vector"#
demo=# SET ROLE app_user;
SET
demo=# CREATE EXTENSION vector;
ERROR: permission denied to create extension "vector"
HINT: Must be superuser to create this extension.
demo=# RESET ROLE;
RESETpgvector is not marked as a trusted extension, so CREATE EXTENSION needs a superuser (or the provider's admin role, such as rds_superuser or azure_pg_admin). Ask an administrator to run it once per database; afterwards ordinary roles can use the type.
type "vector" does not exist#
demo=# \c other
You are now connected to database "other" as user "postgres".
other=# CREATE TABLE t (embedding vector(3));
ERROR: type "vector" does not exist
LINE 1: CREATE TABLE t (embedding vector(3));
^
other=# \c demo
You are now connected to database "demo" as user "postgres".The extension is enabled in a different database, or in a schema that isn't on your search_path (Supabase puts it in extensions). Run CREATE EXTENSION vector; in this database, or qualify the type as extensions.vector. More errors on the troubleshooting page.
Upgrade pgvector#
- Install the new binaries.
apt install postgresql-18-pgvector/brew upgrade pgvector/ pull the new Docker tag / rebuild from the new git tag. - Update each database.
ALTER EXTENSION vector UPDATE;runs the upgrade scripts. If it says the version "is already installed", the server still has the old files — usually a restart or the wrongpg_config. - Check.
SELECT extversion FROM pg_extension WHERE extname = 'vector';
demo=# ALTER EXTENSION vector UPDATE;
NOTICE: version "0.8.7" of extension "vector" is already installed
ALTER EXTENSIONNo release since 0.3.1 has required rebuilding indexes after an upgrade — the changelog's only reindex instruction is for IVFFlat indexes created on 0.2.7 or 0.3.0. Upgrading from an old release? See upgrade notes by version.
Uninstall#
DROP EXTENSION vector;This fails while any column uses a pgvector type. DROP EXTENSION vector CASCADE; succeeds — by dropping every vector column and index in the database. Take a backup first.
Frequently asked questions
Is there a pgvector download for Windows (an .exe or .zip)?
Not from the pgvector project: its GitHub releases page has no binaries, and the maintainers recommend Docker or building from source with Visual Studio's nmake. A community repository (andreiramani/pgvector_pgsql_windows) publishes unofficial prebuilt DLLs — its 0.8.7 release covers PostgreSQL 13–18 — but it is not affiliated with the project, so review it before use. The EDB installer and StackBuilder do not include pgvector.
Does the official postgres Docker image include pgvector?
No. The postgres image only ships PostgreSQL and its contrib extensions. Use pgvector/pgvector:pg18-trixie (built on top of postgres:18-trixie) or install postgresql-18-pgvector in your own Dockerfile.
Which pgvector version do I get with apt install on Ubuntu?
From Ubuntu's own archive, an old one: Ubuntu 24.04 ships 0.6.0 and Debian 13 ships 0.8.0. Add the PostgreSQL Global Development Group (PGDG) repository to get 0.8.7 — that's the method we used to build the test server for this site.
Do I need to run CREATE EXTENSION in every database?
Yes. Installing the package puts the files on the server; CREATE EXTENSION vector; registers the types and operators in one database. Run it once in each database that needs vectors (or in template1 so new databases inherit it).
Which PostgreSQL versions does pgvector 0.8.7 support?
PostgreSQL 13 and newer, and Docker images exist for 13 through 18. The next release, 0.9.0, drops PostgreSQL 13 and 14 according to the upstream changelog, so new projects should start on 16 or later.
How do I check which pgvector version is installed?
Run SELECT extversion FROM pg_extension WHERE extname = 'vector'; for the version active in the current database, and SELECT default_version FROM pg_available_extensions WHERE name = 'vector'; for the version installed on the server. If they differ, run ALTER EXTENSION vector UPDATE;.