Installation

Install pgvector

pgvector supports PostgreSQL 13 and newer. You can compile it from source, or install it with Docker, a package manager, or conda-forge. Pick the method that matches your environment, then enable the extension once per database.

Requirements

  • PostgreSQL 13 or newer (the Docker images ship for 13 through 18).
  • For a source build: a C compiler, make, and the PostgreSQL development headers.
  • Enough privileges to install files into your PostgreSQL directories (make install may need sudo), or permission to install packages.
The commands below pin v0.8.6 and use 18 as the PostgreSQL version. Replace both with the version you actually target. The latest version is available on the releases page.

Download & releases

pgvector has no binary installer — it is a PostgreSQL extension you get as source, a package, or a container image. The current release is v0.8.6 (2026-07-29).

  • Source: download the release from the GitHub releases, or clone the tag and build it.
  • Docker: docker pull pgvector/pgvector:pg18-trixie — tags are available for PostgreSQL 13 through 18.
  • Package managers: Homebrew, APT, Yum, pkg, APK, PGXN, and conda-forge.
From source

Linux & macOS

Compile and install the extension. This is the canonical installation method and works on any Unix-like system with the PostgreSQL development files.

  1. Install PostgreSQL 13+ and the development files for your distribution.
  2. Clone the repository at the release tag.
  3. Build the extension with make.
  4. Install it with make install (add sudo if needed).
Shell bash
cd /tmp
git clone --branch v0.8.6 https://github.com/pgvector/pgvector.git
cd pgvector
make
make install # may need sudo

If compilation fails with postgres.h: No such file or directory, or you have multiple PostgreSQL installations, see install troubleshooting.

From source

Windows

Ensure C++ support in Visual Studio is installed, then open the x64 Native Tools Command Prompt for VS as administrator and build with nmake.

Command Prompt cmd
set "PGROOT=C:\Program Files\PostgreSQL\18"
cd %TEMP%
git clone --branch v0.8.6 https://github.com/pgvector/pgvector.git
cd pgvector
nmake /F Makefile.win
nmake /F Makefile.win install

Set PGROOT to your actual PostgreSQL installation path. Common issues (missing header, architecture mismatch, permissions) are covered in install troubleshooting.

Containers

Docker

The official image adds pgvector to the standard Postgres image. Pull a tag matching your PostgreSQL version, then run it the same way as the Postgres image.

bash
$ docker pull pgvector/pgvector:pg18-trixie
$ docker run --name pgvector -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d pgvector/pgvector:pg18-trixie
Docker tags by PostgreSQL version (pgvector 0.8.6)
PostgreSQLTagsShort tag
18pg18-trixie, 0.8.6-pg18-trixie, pg18-bookworm, 0.8.6-pg18-bookwormpg18, 0.8.6-pg18
17pg17-trixie, 0.8.6-pg17-trixie, pg17-bookworm, 0.8.6-pg17-bookwormpg17, 0.8.6-pg17
16pg16-trixie, 0.8.6-pg16-trixie, pg16-bookworm, 0.8.6-pg16-bookwormpg16, 0.8.6-pg16
15pg15-trixie, 0.8.6-pg15-trixie, pg15-bookworm, 0.8.6-pg15-bookwormpg15, 0.8.6-pg15
14pg14-trixie, 0.8.6-pg14-trixie, pg14-bookworm, 0.8.6-pg14-bookwormpg14, 0.8.6-pg14
13pg13-trixie, 0.8.6-pg13-trixie, pg13-bookworm, 0.8.6-pg13-bookwormpg13, 0.8.6-pg13

Build the image yourself

bash
$ git clone --branch v0.8.6 https://github.com/pgvector/pgvector.git
$ cd pgvector
$ docker build --pull --build-arg PG_MAJOR=18 -t myuser/pgvector .
If you increase maintenance_work_mem, make sure the container --shm-size is at least that size, or parallel HNSW index builds can fail. For example: docker run --shm-size=1g ....
Packages

Package managers

Use a package when it fits your platform. Each command installs pgvector for the named PostgreSQL version — replace 18 with your version.

Homebrew (macOS)

With Homebrew PostgreSQL, install the formula. It is added to the postgresql@18 and postgresql@17 formulas. See the formula page.

Shell bash
brew install pgvector

PGXN

Install from the PostgreSQL Extension Network: pgxn.org/dist/vector.

Shell bash
pgxn install vector

APT (Debian & Ubuntu)

Packages come from the PostgreSQL APT repository. Follow its setup instructions first, then install.

Shell bash
sudo apt install postgresql-18-pgvector

Yum / DNF (RHEL family)

RPM packages come from the PostgreSQL Yum repository. Follow its setup instructions for your distribution, then install.

Shell bash
sudo yum install pgvector_18
# or
sudo dnf install pgvector_18

pkg (FreeBSD)

Install the package, or build from the port. See FreshPorts: databases/pgvector.

Shell bash
pkg install postgresql18-pgvector

# or from the port
cd /usr/ports/databases/pgvector
make install

APK (Alpine)

Install the Alpine package. See Alpine package search.

Shell bash
apk add postgresql-pgvector

conda-forge

With Conda PostgreSQL, install from conda-forge. This method is community-maintained via the pgvector-feedstock.

Shell bash
conda install -c conda-forge pgvector
macOS app

Postgres.app

pgvector comes preinstalled with Postgres.app version 15 and newer. Download the latest release and enable the extension as usual.

CI

GitHub Actions

For continuous integration, use the official pgvector/setup-pgvector action to install pgvector in a GitHub Actions workflow.

Managed

Hosted Postgres

pgvector is available on many hosted PostgreSQL providers, so you often do not need to install anything. Enable the extension as usual once your provider offers it. Check each provider's documentation for the pgvector version it currently supports; the upstream project also maintains a community list in issue #54.

Finish

Enable and verify

Installation places the extension files on the server. To use it, enable the extension once per database, then confirm the version.

  1. Enable the extension with CREATE EXTENSION vector;.
  2. Verify the version with a query against pg_extension — it should report 0.8.6.
SQL postgres
CREATE EXTENSION vector;

SELECT extversion FROM pg_extension WHERE extname = 'vector';
-- expected: 0.8.6

If you see type "vector" does not exist, the extension has not been enabled in that database. Run CREATE EXTENSION vector; while connected to it. See the documentation for the next steps.

Update

Upgrade pgvector

Install the latest version using the same method you originally used, then run the extension update in each database you want to upgrade.

SQL postgres
ALTER EXTENSION vector UPDATE;
SELECT extversion FROM pg_extension WHERE extname = 'vector';
Some releases require extra steps when upgrading from very old versions. Check the changelog before upgrading across major versions.
Remove

Uninstall pgvector

To remove pgvector, drop the extension in each database where it is enabled, then remove the installed files. There is no separate service to stop.

  1. Remove the extension from each database. If columns or indexes use a vector type, either drop them first or use CASCADE to remove the dependent objects automatically.
  2. Remove the installed files using the same method you installed with: your package manager, the Docker image, or — for a source build — the make uninstall target provided by the PostgreSQL extension build system (PGXS).
SQL postgres
-- drops dependent columns and indexes too
DROP EXTENSION vector CASCADE;

-- or, if nothing depends on the type
DROP EXTENSION vector;
pgvector does not publish a supported downgrade procedure. To move to an older version, check the changelog for breaking changes, then reinstall using the same method you originally used.

The make uninstall target comes from PostgreSQL's extension build infrastructure (PGXS).

Fix problems

Install troubleshooting

These are the documented installation problems and their fixes. For query and index problems, see the troubleshooting page.

Compilation fails with fatal error: postgres.h: No such file or directory

Cause: the PostgreSQL development files are not installed.

Fix (Ubuntu / Debian):

Shell bash
sudo apt install postgresql-server-dev-18

Replace 18 with your server version.

Wrong PostgreSQL installation is targeted when several are installed

Cause: pg_config resolves to a different installation than your server.

Fix: point PG_CONFIG at the correct binary and re-run the build (run make clean before make if needed). Use --preserve-env if make install needs sudo.

Shell bash
export PG_CONFIG=/Library/PostgreSQL/18/bin/pg_config
sudo --preserve-env=PG_CONFIG make install

Common macOS paths: EDB /Library/PostgreSQL/18/bin/pg_config; Homebrew arm64 /opt/homebrew/opt/postgresql@18/bin/pg_config; Homebrew x86-64 /usr/local/opt/postgresql@18/bin/pg_config.

Illegal instruction at runtime after compiling

Cause: by default pgvector compiles with -march=native on some platforms for best performance, so the binary may not run on a different CPU.

Fix: compile for portability.

Shell bash
make OPTFLAGS=""
Mac compile warning: no such sysroot directory

Cause: your PostgreSQL installation points to a path that no longer exists.

Fix: inspect the flags, then reinstall PostgreSQL to repair the path.

Shell bash
pg_config --cppflags
Windows: Cannot open include file: 'postgres.h': No such file or directory

Cause: PGROOT does not point to your PostgreSQL installation.

Fix: set PGROOT correctly (see the Windows build) and re-run nmake.

Windows: error C2196: case value '4' already used

Cause: you are not using the x64 toolchain.

Fix: use the x64 Native Tools Command Prompt for VS, clean, and rebuild.

Command Prompt cmd
nmake /F Makefile.win clean
Windows linking: unresolved external symbol float_to_shortest_decimal_bufn

Cause: a known issue with PostgreSQL 17.0–17.2.

Fix: upgrade to PostgreSQL 17.3 or newer.

Windows: Access is denied during install

Cause: insufficient permissions.

Fix: re-run the installation as an administrator.

Installed successfully? Generate your first index with the index planner, start from the quickstart, or grab copy-paste SQL from the cheatsheet.