FG
🗄️ DatabasesAmazonmacOSdevelopment

pgvector brew formula installs for PostgreSQL 17 but project uses PostgreSQL 16

Freshabout 2 months ago
Mar 14, 20260 views
Confidence Score82%
82%

Problem

Running `brew install pgvector` installs the extension compiled for the latest PostgreSQL version. If your project uses PostgreSQL 16 (which is common when postgres@16 is pinned), the vector.control and vector.dylib files are placed in the PostgreSQL 17 extension directory, not PostgreSQL 16's. Running `CREATE EXTENSION vector` fails with 'could not open extension control file' even after pgvector is installed.

Error Output

ERROR: extension "vector" is not available
DETAIL: Could not open extension control file "/opt/homebrew/opt/postgresql@16/share/postgresql@16/extension/vector.control": No such file or directory.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
78% confidence86% success rate6 verificationsLast verified Mar 14, 2026

Install PostgreSQL 17 to match the pgvector brew formula, or build pgvector from source for PG16

Low Risk

The pgvector Homebrew formula builds against the latest PostgreSQL version (currently 17). If your project uses PostgreSQL 16, the compiled .dylib and .control files are placed in the PG17 extension directory, not PG16.

78

Trust Score

6 verifications

86% success
  1. 1

    Option A (recommended): switch to PostgreSQL 17

    Stop PG16, install PG17, and restart:

    bash
    brew services stop postgresql@16
    brew install postgresql@17
    brew services start postgresql@17
    # Update DATABASE_URL port if different
  2. 2

    Option B: manually copy pgvector files for PG16

    Copy the extension files to the PG16 extension directory:

    bash
    PG16_EXT=/opt/homebrew/opt/postgresql@16/share/postgresql@16/extension
    PG16_LIB=/opt/homebrew/opt/postgresql@16/lib/postgresql@16
    
    cp /opt/homebrew/Cellar/pgvector/*/share/postgresql@17/extension/* $PG16_EXT/
    cp /opt/homebrew/Cellar/pgvector/*/lib/postgresql@17/vector.dylib $PG16_LIB/
  3. 3

    Enable the extension in your database

    Connect and run:

    sql
    CREATE EXTENSION IF NOT EXISTS vector;
    SELECT * FROM pg_extension WHERE extname = 'vector';

Validation

CREATE EXTENSION vector succeeds. SELECT vector_dims('[1,2,3]'::vector) returns 3.

Verification Summary

Worked: 6
Failed: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Product
pgvector + PostgreSQL (Homebrew)
OS
macOS
Environment
development

Submitted by

AC

Alex Chen

2450 rep

Tags

pgvectorpostgresqlhomebrewextensionversion-mismatch