15
StandardError: An error has occurred, this and all later migrations canceled:

PG::InternalError: ERROR:  could not load library "/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so": dlopen(/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so, 10): Symbol not found: __ZN5boost7archive21basic_binary_iarchiveINS0_15binary_iarchiveEE13load_overrideERNS0_15class_name_typeEi
  Referenced from: /usr/local/lib/libSFCGAL.1.dylib
  Expected in: /usr/local/lib/libboost_serialization-mt.dylib
 in /usr/local/lib/libSFCGAL.1.dylib
: CREATE EXTENSION IF NOT EXISTS "postgis"/Users/harshamv/Sites/clink/db/migrate/20150812164615_enable_postgis.rb:3:in `change'
-e:1:in `<main>'
ActiveRecord::StatementInvalid: PG::InternalError: ERROR:  could not load library "/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so": dlopen(/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so, 10): Symbol not found: __ZN5boost7archive21basic_binary_iarchiveINS0_15binary_iarchiveEE13load_overrideERNS0_15class_name_typeEi
  Referenced from: /usr/local/lib/libSFCGAL.1.dylib
  Expected in: /usr/local/lib/libboost_serialization-mt.dylib
 in /usr/local/lib/libSFCGAL.1.dylib
: CREATE EXTENSION IF NOT EXISTS "postgis"
/Users/harshamv/Sites/clink/db/migrate/20150812164615_enable_postgis.rb:3:in `change'
-e:1:in `<main>'
PG::InternalError: ERROR:  could not load library "/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so": dlopen(/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so, 10): Symbol not found: __ZN5boost7archive21basic_binary_iarchiveINS0_15binary_iarchiveEE13load_overrideERNS0_15class_name_typeEi
  Referenced from: /usr/local/lib/libSFCGAL.1.dylib
  Expected in: /usr/local/lib/libboost_serialization-mt.dylib
 in /usr/local/lib/libSFCGAL.1.dylib
/Users/harshamv/Sites/clink/db/migrate/20150812164615_enable_postgis.rb:3:in `change'
-e:1:in `<main>'

Am getting the above error all of sudden when i tried to drop and recreate my Rails-PostgreSQL

Harsha M V
  • 54,075
  • 125
  • 354
  • 529

5 Answers5

13

You probably recently upgraded the boost Homebrew formula doing a brew update / brew upgrade, and it seems the latest version is not playing well with postgis.

I fixed a very similar issue by going back to the previous version of boost with:

brew switch boost 1.58.0

UPDATE: now that this was fixed in Homebrew, the answer below suggesting to do a simple update / upgrade is probably the way to go. If you did switch previously, you can now brew switch boost 1.59.0 to upgrade to the latest version of boost, you might also have to brew reinstall postgis.

Marco
  • 1,196
  • 9
  • 11
  • Awesome ! That was my issue ! @Harsha you should accept this answer ! – ZedTuX Nov 03 '15 at 16:43
  • 1
    yes.. boost updated when i did brew update :/ which is the best way to keep things normal but continue getting the latest ? – Harsha M V Nov 03 '15 at 19:15
  • 1
    My 1.58.0 version is gone and so I get `Error: boost does not have a version "1.58.0" in the Cellar. Versions available: 1.59.0`. How can I get the older version? – n1000 Nov 04 '15 at 15:23
  • 1
    Recovered it from Time Machine backup in `/usr/local/Cellar/boost/`. Your solution worked - thanks! Did anyone raise an issue at PostGIS / boost? – n1000 Nov 04 '15 at 15:32
  • Does anyone have boost 1.58 available? I'm on a brand new computer and can't get it – Tyler DeWitt Nov 04 '15 at 19:41
  • You can use `brew pin boost` to keep boost at a particular version. `brew unpin boost` returns it for normal upgrades. – Carl G Nov 06 '15 at 18:28
  • can you update saying that this has been fixed by homebrew. wanna accept this as the answer – Harsha M V Nov 10 '15 at 05:46
  • @HarshaMV updated by answer, thanks for the headsup. – Marco Nov 11 '15 at 12:01
5

This issue has been fixed here. Re-install and it should work.

    $ brew update && upgrade
    $ brew install postgis
geoboy
  • 1,172
  • 1
  • 11
  • 25
3

Couldn't find 1.58.0 either, but 1.55.0_1 is available and successfully installed postgis for me. These entries in effectif and stackoverflow were very helpful. The process may have extra steps.

Just to be sure:

$ brew uninstall postgis

Tap to homebrew versions, if not having it yet:

$ brew tap homebrew/versions

Find the newest available:

$ brew search boost
...
homebrew/versions/boost155
...
$ brew install homebrew/versions/boost155

This installs boost under a different formula (boost155). To be able to switch versions, I symlinked the old version to the boost directory:

$ ln -s /usr/local/Cellar/boost155/1.55.0_1 /usr/local/Cellar/boost/1.55.0_1 

After this it is business as usual:

$ brew switch boost 1.55.0_1
$ brew install postgis
Community
  • 1
  • 1
MiRin
  • 93
  • 9
2

If you need to install a specific version of a formula, take a look at this thread:

Homebrew: install specific version of formula

Community
  • 1
  • 1
charlesdg
  • 814
  • 11
  • 18
2

I just ran into this problem as well, and version 1.56.0 of boostwas available and solved the issue for me. Looks like the problem is specifically with 1.58.0.

Devon C. Estes
  • 171
  • 2
  • 6