I want to use JPEG2000 images in R on a Mac. The problem is if I use custom rgdal downloaded from CRAN, the function raster does not recognize JPEG2000 images. Therefore Jakob described a workaround (Link to the old question: https://gis.stackexchange.com/a/260487/163399) which worked for me last year:

install.packages("rgdal", type = "source", configure.args="--with-gdal-config=/Library/Frameworks/GDAL.framework/unix/bin/gdal-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib --with-proj-share=/Library/Frameworks/PROJ.framework/unix/share/proj --with-proj-data=/Library/Frameworks/PROJ.framework/unix/share/proj --with-data-copy=yes")

But when I try it nowadays on a new Mac with a new R-setup (RStudio: Version 1.2.5033, R: R 3.6.3) it does not work anymore. I installed GDAL using KyngChaos packages (GDAL 2.4.2) but when I execute the command Jakob mentioned, there are the following error messages:

* installing *source* package ‘rgdal’ ...
** Paket ‘rgdal’ erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
configure: R_HOME: /Library/Frameworks/R.framework/Resources
configure: CC: clang
configure: CXX: clang++ -std=gnu++11
configure: C++11 support available
configure: rgdal: 1.4-7
checking for /usr/bin/svnversion... yes
configure: svn revision: 845
configure: gdal-config set to /Library/Frameworks/GDAL.framework/unix/bin/gdal-config
checking gdal-config exists... yes
checking gdal-config executable... yes
checking gdal-config usability... yes
configure: GDAL: 2.4.2
checking C++11 support for GDAL >= 2.3.0... yes
checking GDAL version >= 1.11.4... yes
checking GDAL version <= 2.5 or >= 3.0... yes
checking gdal: linking with --libs only... yes
checking GDAL: gdal-config data directory readable... yes
checking GDAL: /Library/Frameworks/GDAL.framework/Versions/2.4/Resources/gdal/pcs.csv readable... yes
./configure: line 2107: pkg-config: command not found
configure: pkg-config proj not available
set PKG_CONFIG_PATH to the directory containing proj.pc
configure: PROJ version not determined using pkg-config proj
configure: proj CPP flags:  -I/Library/Frameworks/GDAL.framework/Versions/2.4/Headers -I/Library/Frameworks/PROJ.framework/unix/include 
configure: PROJ LIBS: -L/Library/Frameworks/PROJ.framework/unix/lib 
checking PROJ header API:... proj_api.h
checking proj_api.h presence and usability... yes
checking PROJ version >= 4.8.0... yes
configure: PROJ_LIB: /Library/Frameworks/PROJ.framework/unix/share/proj
./configure: line 2350: test: =: unary operator expected
checking PROJ: proj.db found and readable... no
Error: proj/proj.db not found
Either install missing proj support files, set PROJ_LIB to the correct path, and if need be use the --with-proj-share= configure argument.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rgdal’
Warning in install.packages :
installation of package ‘rgdal’ had non-zero exit status

I controlled the corresponding files in the directories and everything seems to be correctly installed. Do you have an idea or solution?

  • Welcome to GIS.se! Please edit your question and explain what you're trying to do, what's expected, and include the actual code you're trying to use.
    – Simbamangu
    May 11, 2020 at 4:37
  • @Simbamangu Thanks, yes I tried to describe it as best and detailed as I could!
    – Tom N.
    Jun 16, 2020 at 17:34


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.