How to install hstore in Postgresql on Mac OSX?

07
2014-04
  • kramer65

    I'm trying to install hstore in Postgres on Mac OSX 10.9, but I'm having major troubles with it. First I had some trouble getting psql to work after installing postgresql using brew, so I finally installed Postgres using postgresql.app. After that I logged into psql, created a database and tried creating the hstore extension using CREATE EXTENSION hstore;, which throws me an error saying ERROR: could not open extension control file "/usr/local/Cellar/postgresql/9.3.2/share/postgresql/extension/hstore.control": No such file or directory.

    I guess that path refers to a brew install, which doesn't exist (I uninstalled the brew version). Would anybody know how I can still install the hstore extension now?

    I'm rather lost here, so all tips are welcome!

  • Answers
  • Craig Ringer

    You didn't actually uninstall the Brew version fully. The PostgreSQL you are connected to is using /usr/local/Cellar/postgresql/9.3.2/share/postgresql/ as $libdir, which is a Homebrew path.

    I'd say you just unlinked it from /usr/local, you didn't really uninstall it, and it's still running quite happily.

    Even if you actually deleted it, on Mac OS X (like most OSes except Windows) you can delete a file that's still open - so PostgreSQL can potentially be still running, even though the files have been deleted. The OS will really delete them when they are closed.


  • Related Question

    mac - How do I fix "Library not loaded: libssl.1.0.0.dylib" with PostgreSQL?
  • Simpleton

    After deleting Macports, I've had some strange behaviour. When I try to run PostgreSQL via CLI, I get:

    pawel:~ pawel$ psql
    dyld: Library not loaded: /opt/local/lib/libssl.1.0.0.dylib
      Referenced from: /usr/local/bin/psql
      Reason: image not found
    Trace/BPT trap
    

    This is strange because I've installed Postgresql through Homebrew and running brew list confirms that it's there. How would I get psql to work again?

    Additionally, trying to install the pg gem fails due to an file not found: /opt/local/lib/libssl.1.0.0.dylib error. I need to make Postgres not look in the /opt/local/ directory for this file.


  • Related Answers
  • Simpleton

    Since I'm answering my own question, I was just going to delete it but others may find it useful in future.

    The solution is to brew uninstall postgresql then install it again. The reason it wasn't working was that the Macports install messed with some of the configs.