Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install pgvector extension on mac

I'm trying to install postgres vector extension on my mac but am getting

ERROR:  extension "vector" has no installation script nor update path for version "0.4.0".

Here's what I did:

  1. Follow the installation guide as shown on github: enter image description here

But when I ran CREATE EXTENSION vector; got an error:

ERROR:  could not open extension control file "/Applications/Postgres.app/Contents/Versions/13/share/postgresql/extension/vector.control": No such file or directory
  1. I copied the content of pgvector into posgresql/extension using:

    sudo cp -r ~/Downloads/pgvector/* /Applications/Postgres.app/Contents/Versions/13/share/postgresql/extension/

Tried running CREATE EXTENSION vector; now the error is:

ERROR:  extension "vector" has no installation script nor update path for version "0.4.0".

Anyone here seen this problem?

By the way am using PostgreSQL 13.10

like image 992
Yankz Kuyateh Avatar asked Apr 26 '26 03:04

Yankz Kuyateh


1 Answers

I had this same issue and was able to fix it.

My Setup

  • postgres v 14
  • installed via Postgres.app

First Mistake (mixed PG config)

Even though I installed PG via the PG app, I tried to install this extension using Homebrew. This messed up some of the PG config settings.

Running this on the command line,

pg_config --libdir

Gave this output: /opt/homebrew/share/postgresql@14

This is not good for a Postgres.app install.

The Fix (reset pg configs)

Assuming Postgres.app install!

brew uninstall pgvector

brew uninstall postgresql

Now run:

pg_config --libdir

I get: /Applications/Postgres.app/Contents/Versions/14/lib

Now, install pgvector using the Makefile approach.

2nd Mistake (Extension files in the wrong place)

Don't (as OP did), just copy the pgvector files to the Postgress extensions directory. This will create an invalid directory structure.

I believe make install will place the files in the proper place. If CREATE EXTENSION vector; still fails, you can check the following to ensure the files are in the right place.

The Fix

You should have the following files installed in the following directories.

All .SQL and .control files. Ensure these files are in the following directory

/Applications/Postgres.app/Contents/Versions/14/share/postgresql/extension

vector.so is in the following directory

/Applications/Postgres.app/Contents/Versions/14/lib/postgresql

Install the extension

psql <your db>
CREATE EXTENSION vector;
like image 165
Michael Brown Avatar answered Apr 29 '26 01:04

Michael Brown



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!