I'm trying to get PostgreSQL up and running on my MacOSX 10.9.4.
I successfully installed PostgreSQL itself using Homebrew by following the instructions listed here: https://www.codefellows.org/blog/how-to-install-postgresql. It's up and I can connect to it using the psql
command.
However, when I try to create the postgis extension, it fails (see below). I understand I need to install postgresql-contrib-9.3
.
$ psql -d mydb
psql (9.3.5)
Type "help" for help.
mydb=# CREATE EXTENSION postgis;
ERROR: could not open extension control file "/usr/local/Cellar/postgresql/9.3.5/share/postgresql/extension/postgis.control": No such file or directory
How can I install this postgresql-contrib-9.3
on Mac OSX? I don't have apt-get
. The instructions I have seen are not at all clear how to install it. Can someone please advise?
Step by step guide to set up a local PostgreSQL on Mac using DBngin: Download DBngin from it's download page and install on your Mac just like any other Mac apps. Open DBngin and click on + new server button. Choose PostgreSQL from the driver list, choose your PostgreSQL version, and name you server.
The postgresql-contrib package includes extensions and additions that are distributed along with the PostgreSQL sources, but are not (yet) officially part of the PostgreSQL core. Documentation for the modules contained in this package can be found in /usr/share/doc/packages/postgresql/contrib.
psql -c "SELECT 1" -d {dbname} > /dev/null || postgres -D /usr/local/var/postgres >postgres. log 2>&1 & if you want to check and start postgres in one go (handy for automation scripts).
I found the answer here: http://postgis.net/install:
$ brew install postgis
<SNIP SNIP>
$ psql -d mydb
psql (9.3.5)
Type "help" for help.
dbname=# CREATE EXTENSION postgis;
CREATE EXTENSION
On postgresql 9.4 contrib seems to be a part of the default installation. I was able to install cube and earthdistance like
PGUSER=postgres psql my-db
create extension cube;
create extension earthdistance;
from a default macports postgresql94-server installation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With