Ish
Ish

Reputation: 105

Assistance installing 'rgdal' package on Mac

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’

Upvotes: 6

Views: 4550

Answers (2)

Umar
Umar

Reputation: 494

after installing gdgal using brew in command line terminal brew install gdal try first instaling rgeos and then rgdal, it worked for me

install.packages("rgeos", repos="http://R-Forge.R-project.org", type="source")
install.packages("rgdal", repos="http://R-Forge.R-project.org", type="source")

Upvotes: 0

PeterParker
PeterParker

Reputation: 66

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")'

Upvotes: 5

Related Questions