2

I am trying to run "ogr2ogr" command

macbook$ sudo ogr2ogr -f "PostgreSQL" PG:"dbname=test user=postgres" /Users/macbook/planning.gdb

But I am getting this error:

dyld: Library not loaded: /Library/Frameworks/GDAL.framework/Versions/1.10/GDAL
  Referenced from: /Library/Frameworks/GDAL.framework/Programs/ogr2ogr
  Reason: no suitable image found.  Did find:
    /usr/local/lib/GDAL: not a file

I following this answer : Error Updating GDAL with Homebrew

macbook$ export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH
macbook$ which ogr2ogr 
/Library/Frameworks/GDAL.framework/Programs/ogr2ogr

But I am getting this error whenever I run the "ogr2ogr" command 

macbook$ sudo ogr2ogr -f "PostgreSQL" PG:"dbname=test user=postgres" /Users/macbook/planning.gdb
dyld: Library not loaded: /Library/Frameworks/GDAL.framework/Versions/1.10/GDAL
  Referenced from: /Library/Frameworks/GDAL.framework/Programs/ogr2ogr
  Reason: no suitable image found.  Did find:
    /usr/local/lib/GDAL: not a file

When I run : macbook$ ls /usr/local/lib/ I can find the folder :

dtrace                  libopencv_highgui.dylib
gcc                 libopencv_imgproc.2.4.6.dylib
gdal                    libopencv_imgproc.2.4.dylib
1
  • Have you tried running ogr2ogr without sudo? – user2856 Mar 30 '14 at 9:50
1

You have a problem with your PATHS:

  1. with Homebrew, GDAL is installed in /usr/local/Cellar with symbolic links of the programs (ogr2ogr, etc.) in /usr/local/bin

  2. with the Frameworks of KyngChaos, the versions of GDAL are installed in /Library/Frameworks/GDAL.framework/Versions/1.x/GDAL with the programs in /Library/Frameworks/GDAL.framework/Versions/1.x/Programs (/Library/Frameworks/GDAL.framework/Programs is a symbolic link for the version used)

    enter image description here

The programs of the KyngChaos distribution use the libraries present in the Framework folder (/Library/Frameworks/GDAL.framework)and not those present in /usr/local/lib/GDAL(for Homebrew).

To verify the correct paths, type in the Console:

otool -L ogr2ogr

If the result is:

ogr2ogr:
/Library/Frameworks/GDAL.framework/Versions/1.10/GDAL (compatibility version ...)

You are using the GDAL libraries of KyngChaos

If the result is

ogr2ogr:
/usr/local/lib/GDAL (compatibility version ...)
    ....

You are still using the Homebrew libraries even if if you type export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH

So you must adapt your paths, look at Building GDAL 1.9.x with ESRI FileGDB support on OS X Lion for example.

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.