I am trying to install GDAL on MacOS with Homebrew. But failed. I started with the following commands:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install gdal --HEAD
brew install gdal —-only-dependencies
brew install gdal
pip3 install gdal
The first command check if I have installed the Homebrew. The others are step by step installation of gdal. It works fun when I try to take a look with the version of gdal:
gdal-config --version
# out put: 3.0.2
But when I trying to convert .tif to .raw with gdal_translate:
gdal_translate –ot UInt16 –scale –of ENVI –outsize 1025 1025 srtm_59_05.tif heightmap.raw
There comes the following problem.
dyld[54967]: Library not loaded: @rpath/libpoppler.91.dylib
Referenced from: /Users/[my_username_here]/opt/anaconda3/lib/libgdal.26.dylib
Reason: tried: '/Users/[my_username_here]/opt/anaconda3/lib/libpoppler.91.dylib' (no such file),
'/Users/[my_username_here]/opt/anaconda3/bin/../lib/libpoppler.91.dylib' (no such file),
'/Users/[my_username_here]/opt/anaconda3/bin/../lib/libpoppler.91.dylib' (no such file),
'/usr/local/lib/libpoppler.91.dylib' (no such file), '/usr/lib/libpoppler.91.dylib' (no such file)
[1] 54967 abort gdal_translate –ot UInt16 –scale –of ENVI –outsize 1025 1025
What should I do? Can anyone help me out?
The problem seems comes from something called poppler, so I ran
brew reinstall poppler
It gives me
Warning: poppler 21.12.0 is already installed and up-to-date.
To reinstall 21.12.0, run:
brew reinstall poppler
If I reinstall poppler, the error is still there.
Here is the result of searching the folder of poppler, using
# locate the folder of poppler, gives "/opt/homebrew/Cellar/poppler/21.12.0"
brew ls --verbose poppler
# search for keyword "poppler" in filenames
find /opt/homebrew/Cellar/poppler/21.12.0 -name '*poppler*'
It gives
/opt/homebrew/Cellar/poppler/21.12.0/.brew/poppler.rb
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/poppler_private_export.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/poppler-config.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-annot.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-page.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-attachment.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-features.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-enums.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-form-field.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-date.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-action.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-layer.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-movie.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-document.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-macros.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-structure-element.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/glib/poppler-media.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/qt6/poppler-form.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/qt6/poppler-export.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/qt6/poppler-optcontent.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/qt6/poppler-page-transition.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/qt6/poppler-annotation.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/qt6/poppler-qt6.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/qt6/poppler-link.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/qt6/poppler-version.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/qt6/poppler-media.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler-page.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler-image.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler-global.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler-font-private.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler-page-transition.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler-toc.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler-document.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler-rectangle.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler-page-renderer.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler-destination.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler_cpp_export.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler-version.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler-embedded-file.h
/opt/homebrew/Cellar/poppler/21.12.0/include/poppler/cpp/poppler-font.h
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler-qt6.3.dylib
/opt/homebrew/Cellar/poppler/21.12.0/lib/pkgconfig/poppler.pc
/opt/homebrew/Cellar/poppler/21.12.0/lib/pkgconfig/poppler-cpp.pc
/opt/homebrew/Cellar/poppler/21.12.0/lib/pkgconfig/poppler-glib.pc
/opt/homebrew/Cellar/poppler/21.12.0/lib/pkgconfig/poppler-qt6.pc
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler-qt6.dylib
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler-cpp.0.9.0.dylib
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler.a
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler-glib.dylib
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler-cpp.a
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler-glib.8.22.0.dylib
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler-qt6.3.1.0.dylib
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler-cpp.0.dylib
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler-glib.8.dylib
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler.116.0.0.dylib
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler-cpp.dylib
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler.116.dylib
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler.dylib
/opt/homebrew/Cellar/poppler/21.12.0/lib/libpoppler-glib.a
/opt/homebrew/Cellar/poppler/21.12.0/share/pkgconfig/poppler-data.pc
/opt/homebrew/Cellar/poppler/21.12.0/share/poppler
The problem is solved:
As https://github.com/OSGeo/gdal/issues/5348 issue.
It looks to be a mix of Conda and homebrew in your system. Perhaps try deactivating your Conda environment. I'm afraid I can't help more.
Just shot down Anaconda and redo everything with only Homebrew.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With