hello i was trying to install postgis to one of my database with the following command
CREATE EXTENSION postgis;
but it returned an error of
ERROR:
could not open extension control file "/Library/PostgreSQL/13/share/postgresql/extension/postgis.control": No such file or directory
how do i install postgis without it giving an error?
UPDATE: I have tried it on the default databases postgres.app gives you which is your desktop username(mine is aarushsharma), i tried to do
CREATE EXTENSION postgis;
and it worked so i think it is a problem to do with my specific postgres user
first you need to download and install Postgis if you haven't , follow this.
if you are on Linux , you have to install 2 packages ,postgis
and postgresql-13-postgis-3
only PostGIS 3,0 and above works with Postgresql 13 :
commands on Debian based distros ( I installed from PostgreSQL repository) :
sudo apt install postgis postgresql-13-postgis-3
on mac you can install it via brew
by running this command in terminal:
brew install postgis
if you don't have brew
installed then install it first :
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
If you have installed using postgressApp
, Open the Terminal and enter the following two commands:
actually first follow step 3 from Installing Postgres.app documentation:
sudo mkdir -p /etc/paths.d &&
echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
then :
psql -d DATABASE_NAME -f /Applications/Postgres.app/Contents/Versions/[Postgresqlversion]/share/postgresql/contrib/postgis-[PostGisVersion]/postgis.sql
psql -d DATABASE_NAME -f /Applications/Postgres.app/Contents/Versions/[Postgresqlversion]/share/postgresql/contrib/postgis-[PostGisVersion]/spatial_ref_sys.sql
then you should be able to enable the extension :
CREATE EXTENSION postgis;