0
votes

I'm trying to create a postgis extension on my PostgreSQL database for a Django project, but when I run CREATE EXTENSION postgis I get this error:

ERROR: extension "postgis" has no installation script nor update path for version "3.0.1"

I installed all the dependencies with Homebrew on macOS, and this database is not on the 'postgres' user, it's on my own superuser.

Homebrew Dependency Versions

Any help is appreciated!! Been working on this issue for the last week.

1
Are you required to install it directly in macOS? You may find it easier (and more portable) to use Docker for this.Jeremy
From: postgis.net/install : Homebrew users can just run “brew install postgis” and tends to be a favorite for more advanced users since there are brew scripts for most of the popular PostgreSQL extensions, not always present in other Mac distributions. Sorry, cannot do more.LittleEaster

1 Answers

0
votes

From what I could determine, this is likely due to a versioning error between postgres and postgis. It seems that brew install postgis will install the most recent version of postgres and make the postgis extension available only to that version. I got it to work by uninstalling previous versions of postgres and doing a clean install of the most recent version (the one the postgis is expecting). You can find the version postgis is expecting by searching the homebrew site.

First, back up your database if you need to save your data. (See pgdump.)

Next, stop all of the running postgres server instances. Try the following:

  • Use brew services list to see all postgres services running. Use brew services stop [name] to stop any listed postgres services that are running.
  • Use sudo lsof -i :5432 to confirm that no database server is listening on port 5432. (This is the default port for postgres.) If you see any results, use sudo kill [pid] to stop the server.

Now, uninstall postgres:

brew uninstall --force postgresql

Then delete the database file (this removes your data so make a backup):

rm -rf /usr/local/var/postgres

Now you can follow these setup instructions to install postgres. Note that the default superuser of your database will be the one you use to do the initdb command. Thus, you may want to use sudo -u postgres before doing the initdb to keep the default database superuser name "postgres". (See more about default users here.)