I am trying to import shapefile to PostGIS. I have problem configuring shp2pgsql.

I am getting this error :

dyld: Library not loaded: @loader_path/../lib/liblwgeom-2.1.1.dylib
  Referenced from: /Library/PostgreSQL/9.3/bin/shp2pgsql
  Reason: image not found

I am trying to explore where the command is:

macbook$ locate shp2pgsql

macbook$ ls /usr/bin/shp2pgsql

I installed "liblwgeom" using homebrew,

macbook$ ls /usr/local/opt/liblwgeom/lib

Do you have any idea how to resolve this issue .

  • Can you try creating a symlink /Library/PostgreSQL/9.3/lib/liblwgeom-2.1.1.dylib that points to /usr/local/opt/liblwgeom/lib/liblwgeom-2.1.1.dylib, then retry the import? – BradHards Apr 5 '14 at 7:18
  • yes ! this is how I solved the prob ! – user3378649 Apr 6 '14 at 1:35
  • OK, I added that as an answer. – BradHards Apr 6 '14 at 1:48

One way to solve this is to create a symlink /Library/PostgreSQL/9.3/lib/liblwgeom-2.1.1.dylib that points to /usr/local/opt/liblwgeom/lib/liblwgeom-2.1.1.dylib.

There are other ways (setting library path environment variables, using homebrew for everything), but this is probably the most efficient. Note that if you do need to upgrade lwgeom, you may need to create a new symlink.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.