How do you install "rgdal" package on a MacOS Catalina?
Ran the following code:
install.packages('rgdal', type = "source", configure.args=c(
'--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config',
'--with-proj-include=/Library/Frameworks/PROJ.framework/Headers',
'--with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'))
Obtain the following error message:
trying URL 'https://cran.rstudio.com/src/contrib/rgdal_1.4-8.tar.gz'
Content type 'application/x-gzip' length 1698902 bytes (1.6 MB)
==================================================
downloaded 1.6 MB
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: R_HOME: /Library/Frameworks/R.framework/Resources
xcrun: error: invalid active developer path /Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
configure: C++11 support not available
configure: rgdal: 1.4-7
checking for /usr/bin/svnversion... yes
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
configure: svn revision: 845
configure: gdal-config set to /Library/Frameworks/GDAL.framework/Programs/gdal-config
checking gdal-config exists... no
configure: error: gdal-config not found - configure argument error.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rgdal’
Warning in install.packages :
installation of package ‘rgdal’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/vz/0nmhj0qj27s_y3zjxjx6w3g40000gn/T/RtmpW2iTzA/downloaded_packages’
Install and use Homebrew per Ish's comment. It will make this install work and you will be able to avoid other common installation errors with R Packages on MacOSX.
In terminal after Homebrew install run 'brew install gdal' then in R use the installation package 'install.packages("rgdal", type="source")'