Any idea on how to install pgrouting for postgres.app in mac?
I tried to restore a backup file and it's showing the following error:
extension "pgrouting" does not exist
Any idea on how to install pgrouting for postgres.app in mac?
I tried to restore a backup file and it's showing the following error:
extension "pgrouting" does not exist
I gave up trying to get pgrouting to work with postgres.app on Mac. I'm sure it's possible, but it was much more straightforward to ditch postgres.app, install pgrouting via homebrew, and use the instance of postgres that homebrew installs as the server. The process was as follows...
First I removed all instances of postgres from my machine, to start everything fresh.
Then I used the command
brew install pgrouting
This installs pgrouting and its dependencies (postgresql and postgis) via the same operation, ensuring versions are in sync etc.
Initialise, then start the postgres server:
initdb ~/my-postgres-server -E utf8
pg_ctl -D ~/my-postgres-server -l logfile start
Now we need to create a database and enable postgis and then pgrouting on it
createdb my-db
psql my-db -c 'CREATE EXTENSION postGIS'
psql my-db -c 'CREATE EXTENSION pgRouting'
If all of that worked without errors you should be in business. You can connect to your server with your usual database management tool such ad pgadmin via the server localhost
on the default port 5432, using your system username as the user and no password. Then you can get busy with pgrouting on my-db
!
P.S You can shutdown the postgres server with pg_ctl -D ~/my-postgres-server stop
and start it on demand again using the command above.
I was able to first compile and install pgRouting from sources for the Homebrew Postgres version and then copy it into the Postgres.app folder.
First you have to copy the compiled (and installed) library:
cp /usr/local/Cellar/postgresql@15/15.2/lib/postgresql/libpgrouting-3.4.so /Applications/Postgres.app/Contents/Versions/15/lib/postgresql
and then *.sql and *.control files:
cp /usr/local/opt/postgresql@15/share/postgresql@15/extension/pgrouting* /Applications/Postgres.app/Contents/Versions/15/share/postgresql/extension
Also make sure your versions of PostgreSQL in Homebrew and Postgres.app match.