In the terminal, I ran
$ psql
In psql he showed me this
> psql (9.6.3, server 9.5.7) > Type "help" for help.
I tried to run the following
> CREATE EXTENSION postgis;
and got this error message
> ERROR: could not open extension control file "/usr/local/Cellar/ postgresql@9.5 /9.5.7/share/ postgresql@9.5 /extension/postgis.control": No such file or directory
I exit psql on
> \q
And then ran
$ brew services list
who then returned with the following results
Name Status User Plist mysql stopped mysql@5.6 stopped postgresql stopped postgresql@9.5 started doquyena /Users/doquyena/Library/LaunchAgents/ homebrew.mxcl.postgresql@9.5.plist redis stopped
I realized that my psql is running on an incompatible psql server, so I fixed it with the following command
$ brew services stop postgresql@9.5 $ brew services start postgresql
When I returned to psql
$ psql
Now it displays this, which indicates that I was now on the corresponding server
> psql (9.6.3) > Type "help" for help.
Therefore, there was no error message when I tried to create the extension again
> CREATE EXTENSION postgis;
And then I managed to create postgis data tables like this without any problems
> CREATE TABLE s_test(geom geometry);
source share