Shapefile (sf) and tmap packages not installing in ARM64 version of RStudio (v1.4.1614)

Hi All,

I set up the ARM64 version of RStudio (v1.4.1614) on my MacBook Pro with Apple Silicon. Overall it is working well, but I did run into a problem trying to install the "sf" (shapefile) package. When I do this, I get an error saying that the gdal-config is not installed.

I tried to install the gdal package using the instructions below but this did not solve the problem:

Is there another way I can try to install the gdal package?

Below is part of the output I received (I could not post the complete output due to restrictions in this forum regarding links):

  • installing source package ‘sf’ ...
    ** package ‘sf’ successfully unpacked and MD5 sums checked
    ** using staged installation
    configure: CC: clang
    configure: CXX: clang++ -std=gnu++11
    checking for gdal-config... no
    no
    configure: error: gdal-config not found or not executable.
    ERROR: configuration failed for package ‘sf’

This is not related to the RStudio IDE, the problem seems to be that the gdal system library is not correctly installed, I recommend you to look for ways to install gdal on Apple Silicone systems.

To overcome this limitation, post the console output as formatted code, here is how to do it.

You can compile the GDAL package from source https://gdal.org/download.html#download

I am not sure how to do that on Apple Silicon though...

Thank you andresrcs and jlacko!

I have installed the GDAL package using Brew, and it's version is:
gdalinfo --version
GDAL 3.2.1, released 2020/12/29

Below is the code output I get when trying to install sf and tmap packages. Is there anything else I should check?

Show in New Window

** Installing R Packages: 'sf', 'tmap'
[1/5] Installing sf...
Package which is only available in source form, and may need
  compilation of C/C++/Fortran: ‘sf’
installing the source package ‘sf’

trying URL 'https://cran.rstudio.com/src/contrib/sf_0.9-7.tar.gz'
Content type 'application/x-gzip' length 4203095 bytes (4.0 MB)
==================================================
downloaded 4.0 MB

* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: clang
configure: CXX: clang++ -std=gnu++11
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘sf’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/sf’
[2/5] Installing tmaptools...

The downloaded source packages are in
	‘/private/var/folders/kt/wk55fndj0d7ch9gzjzy1f1mw0000gn/T/RtmppOg7n9/downloaded_packages’
also installing the dependencies ‘sf’, ‘lwgeom’, ‘stars’

Packages which are only available in source form, and may need
  compilation of C/C++/Fortran: ‘sf’ ‘lwgeom’
installing the source packages ‘sf’, ‘lwgeom’, ‘stars’, ‘tmaptools’

trying URL 'https://cran.rstudio.com/src/contrib/sf_0.9-7.tar.gz'
Content type 'application/x-gzip' length 4203095 bytes (4.0 MB)
==================================================
downloaded 4.0 MB

trying URL 'https://cran.rstudio.com/src/contrib/lwgeom_0.2-5.tar.gz'
Content type 'application/x-gzip' length 501653 bytes (489 KB)
==================================================
downloaded 489 KB

trying URL 'https://cran.rstudio.com/src/contrib/stars_0.5-1.tar.gz'
Content type 'application/x-gzip' length 5046980 bytes (4.8 MB)
==================================================
downloaded 4.8 MB

trying URL 'https://cran.rstudio.com/src/contrib/tmaptools_3.1-1.tar.gz'
Content type 'application/x-gzip' length 40116 bytes (39 KB)
==================================================
downloaded 39 KB

* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: clang
configure: CXX: clang++ -std=gnu++11
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘sf’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/sf’
ERROR: dependency ‘sf’ is not available for package ‘lwgeom’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/lwgeom’
ERROR: dependencies ‘sf’, ‘lwgeom’ are not available for package ‘stars’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/stars’
[3/5] Installing stars...
ERROR: dependencies ‘sf’, ‘lwgeom’, ‘stars’ are not available for package ‘tmaptools’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/tmaptools’

The downloaded source packages are in
	‘/private/var/folders/kt/wk55fndj0d7ch9gzjzy1f1mw0000gn/T/RtmppOg7n9/downloaded_packages’
also installing the dependencies ‘sf’, ‘lwgeom’

Packages which are only available in source form, and may need
  compilation of C/C++/Fortran: ‘sf’ ‘lwgeom’
installing the source packages ‘sf’, ‘lwgeom’, ‘stars’

trying URL 'https://cran.rstudio.com/src/contrib/sf_0.9-7.tar.gz'
Content type 'application/x-gzip' length 4203095 bytes (4.0 MB)
==================================================
downloaded 4.0 MB

trying URL 'https://cran.rstudio.com/src/contrib/lwgeom_0.2-5.tar.gz'
Content type 'application/x-gzip' length 501653 bytes (489 KB)
==================================================
downloaded 489 KB

trying URL 'https://cran.rstudio.com/src/contrib/stars_0.5-1.tar.gz'
Content type 'application/x-gzip' length 5046980 bytes (4.8 MB)
==================================================
downloaded 4.8 MB

* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: clang
configure: CXX: clang++ -std=gnu++11
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘sf’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/sf’
ERROR: dependency ‘sf’ is not available for package ‘lwgeom’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/lwgeom’
[4/5] Installing leafem...
ERROR: dependencies ‘sf’, ‘lwgeom’ are not available for package ‘stars’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/stars’

The downloaded source packages are in
	‘/private/var/folders/kt/wk55fndj0d7ch9gzjzy1f1mw0000gn/T/RtmppOg7n9/downloaded_packages’
also installing the dependency ‘sf’

Package which is only available in source form, and may need
  compilation of C/C++/Fortran: ‘sf’
installing the source packages ‘sf’, ‘leafem’

trying URL 'https://cran.rstudio.com/src/contrib/sf_0.9-7.tar.gz'
Content type 'application/x-gzip' length 4203095 bytes (4.0 MB)
==================================================
downloaded 4.0 MB

trying URL 'https://cran.rstudio.com/src/contrib/leafem_0.1.3.tar.gz'
Content type 'application/x-gzip' length 3047855 bytes (2.9 MB)
==================================================
downloaded 2.9 MB

* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: clang
configure: CXX: clang++ -std=gnu++11
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘sf’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/sf’
[5/5] Installing tmap...
ERROR: dependency ‘sf’ is not available for package ‘leafem’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/leafem’

The downloaded source packages are in
	‘/private/var/folders/kt/wk55fndj0d7ch9gzjzy1f1mw0000gn/T/RtmppOg7n9/downloaded_packages’
also installing the dependencies ‘lwgeom’, ‘tmaptools’, ‘sf’, ‘stars’, ‘leafem’

Packages which are only available in source form, and may need
  compilation of C/C++/Fortran: ‘lwgeom’ ‘sf’
installing the source packages ‘lwgeom’, ‘tmaptools’, ‘sf’, ‘stars’, ‘leafem’, ‘tmap’

trying URL 'https://cran.rstudio.com/src/contrib/lwgeom_0.2-5.tar.gz'
Content type 'application/x-gzip' length 501653 bytes (489 KB)
==================================================
downloaded 489 KB

trying URL 'https://cran.rstudio.com/src/contrib/tmaptools_3.1-1.tar.gz'
Content type 'application/x-gzip' length 40116 bytes (39 KB)
==================================================
downloaded 39 KB

trying URL 'https://cran.rstudio.com/src/contrib/sf_0.9-7.tar.gz'
Content type 'application/x-gzip' length 4203095 bytes (4.0 MB)
==================================================
downloaded 4.0 MB

trying URL 'https://cran.rstudio.com/src/contrib/stars_0.5-1.tar.gz'
Content type 'application/x-gzip' length 5046980 bytes (4.8 MB)
==================================================
downloaded 4.8 MB

trying URL 'https://cran.rstudio.com/src/contrib/leafem_0.1.3.tar.gz'
Content type 'application/x-gzip' length 3047855 bytes (2.9 MB)
==================================================
downloaded 2.9 MB

trying URL 'https://cran.rstudio.com/src/contrib/tmap_3.3.tar.gz'
Content type 'application/x-gzip' length 3120127 bytes (3.0 MB)
==================================================
downloaded 3.0 MB

* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: clang
configure: CXX: clang++ -std=gnu++11
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘sf’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/sf’
ERROR: dependency ‘sf’ is not available for package ‘lwgeom’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/lwgeom’
ERROR: dependency ‘sf’ is not available for package ‘leafem’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/leafem’
ERROR: dependencies ‘sf’, ‘lwgeom’ are not available for package ‘stars’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/stars’
ERROR: dependencies ‘sf’, ‘lwgeom’, ‘stars’ are not available for package ‘tmaptools’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/tmaptools’
ERROR: dependencies ‘tmaptools’, ‘sf’, ‘stars’, ‘leafem’ are not available for package ‘tmap’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/tmap’

The downloaded source packages are in
	‘/private/var/folders/kt/wk55fndj0d7ch9gzjzy1f1mw0000gn/T/RtmppOg7n9/downloaded_packages’


✔ Packages successfully installed.
There were 16 warnings (use warnings() to see them)

Hi All, I have done further digging and andresrcs is on the right track. The issue lies more with the sf package compiling on an ARM64 processor and NOT the new RStudio IDE. Thank you for your help!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.