How to install Postgis to a Keg installation of Postgres@9.6 using Homebrew?

后端 未结 3 518
青春惊慌失措
青春惊慌失措 2020-12-28 09:37

I have installed Postgresql@9.6 and Postgis via Homebrew. However, installing Postgis via Homebrew installs the latest version of Postgresql at 10 as dependency and pinning

3条回答
  •  攒了一身酷
    2020-12-28 09:59

    Hello

    I ran into this same problem of multiple implementation of pgsql versions including legacy ones. So after a bit of research I would like to share my solution.

    Problem:

    I am working on a macbook pro 2013 with 10.11 el capitan. I am GIS developer and extensive user of homebrew. I didn't pin the postgresql package for compatibility reasons. Thus, the package got updated to postgresql version 10.5 along other packages. This caused me to be unable to use postgresql version 9.4. The cleverest solution would have been to use a brew switch postgresql 9.4.19. Except that when compiling postgis 2.5.0 from osgeo/osgeo4mac it defautls (looks for) the postgresql binary folder to install the symlinked (or not) extensions. Here again another compatibility problem. One could tinker a bit with homebrew files and transfer files manually. That's ill advice...the package manager (homebrew) needs to stay a coherent ecosystem to provide for a stable workspace.

    Proposed Solution:

    1. Go here BigSQL and download the dmg of your chosen version
    2. install the software where you want in your filesystem
    3. within the installation folder you'll find a directory named pg9x ; x being the version number (e.g pg95 for postgresql 9.5 and so on...
    4. in this folder you'll find a file named pg9x.env
    5. source this file to your .profile with source /your/path/pg9x/pg9x.env line
    6. in the main installation folder, for instance /your/path/pg9x/, you'll finde a python script called pgc, alias it to your .profile with alias pgc="your/path/pgc"
    7. save your .profile and refresh your environment variable with source .profile on the command prompt
    8. still within the command prompt, type pgc list, you'll get a list of installed packages. You'll see the version of postgesql you've downloaded
    9. to install another version of postgresql, say 9.6, type pgc install pg96
    10. to install postgis for pg95 type pgc install postgis22-pg95
    11. to install postgis for pg96 type pgc install postgis23-pg96
    12. now, after installation you'll need to initialize the downloaded component with pgc init pg96 or pgc init postgis23-pg96 etc...
    13. to check if your daemon is running correctly type pgc status
    14. to start a version daemon of your choice type for example pgc start pg95
    15. to stop a version daemon of your choice type pgc stop pg95
    16. the installation also comes with an LTS release of pgadmin3 that works fine with all versions (not the case of brew version of pgadmin3), this is very convenient
    17. type pgc help for more options

    Let the elephant dance^^

    Hope this helps.

    Spicy.

提交回复
热议问题