[R-SIG-Mac] sf installation problem under Mac OS 11 - Big Sur

Gilberto Camara gc@m@r@ @end|ng |rom geo@ec@org
Thu Nov 19 14:46:25 CET 2020

Dear Prof Ripley

There have been reports as follows:

https://community.rstudio.com/t/rgdal-library-not-loading/88025 <https://community.rstudio.com/t/rgdal-library-not-loading/88025>

https://github.com/r-spatial/sf/issues/1542 <https://github.com/r-spatial/sf/issues/1542>

Prof Dr Gilberto Camara
Secretariat Director
GEO - Group on Earth Observations
7 bis, Avenue de La Paix
CH-1211 Geneva - Switzerland
Tel: +41227308480
Web: www.earthobservations.org

> On 19 Nov 2020, at 14:43, Prof Brian Ripley <ripley using stats.ox.ac.uk> wrote:
> On 19/11/2020 11:22, GilbertoCamara wrote:
>> Dear all,
>> Mac users that have upgraded to Mac OS 11 BigSur have reported having problems with “rgdal” and “sf”. The same happened to me when I upgraded my Mac.
> What problems are those?  You report nothing, and make reference to no reports here nor on R-sig-geo.
> I tried the binary package of sf on my Intel 'Big Sur' machine and got
> > library(sf)
> Error: package or namespace load failed for ‘sf’ in dyn.load(file, DLLpath = DLLpath, ...):
> unable to load shared object '/Users/ripley/R/Library/sf/libs/sf.so':
>  dlopen(/Users/ripley/R/Library/sf/libs/sf.so, 6): Library not loaded: /usr/lib/libpq.5.dylib
>  Referenced from: /Users/ripley/R/Library/sf/libs/sf.so
>  Reason: image not found
> so it seem Apple has removed the PostgreSQL library.
>> I managed to get "sf" to run on MacOS 11.0.1 by recompiling most of the required packages. Here's the recipe:
>> 1. Remove all spatial software from brew (if you installed it). Rgdal does not like "brewed" stuff (I believe Roger prefers wine). Seriously, it appears that rgdal looks for libraries in their default places and not in the "Cellar" libraries used by "brew".
>> 2. Install Xcode 12.3beta (downloaded from Apple Developers). This is the latest version of XCode which is compatible with MacOS BigSur.
>> 3. Install "wget" using brew:
>> "brew install wget".
>> 4. Download the libraries below from their sources:
>> (a) sqlite-autoconf-3330000.tar.gz from "https://www.sqlite.org/download.html <https://www.sqlite.org/download.html>".
>> (b) tiff-4.1.0.tar.gz from "https://download.osgeo.org/libtiff/ <https://download.osgeo.org/libtiff/>"
>> (c) proj-7.2.0.tar.gz from "https://proj.org/download.html#current-release <https://proj.org/download.html#current-release>"
>> (d) libgeotiff-1.6.0.tar.gz from "https://download.osgeo.org/geotiff/libgeotiff/ <https://download.osgeo.org/geotiff/libgeotiff/>"
>> (e) geos-3.8.1.tar.bz2 from "https://trac.osgeo.org/geos <https://trac.osgeo.org/geos>"
>> (f) gdal-3.2.0.tar.gz from "https://gdal.org/download.html <https://gdal.org/download.html>"
> At the bottom of https://mac.r-project.org/libs-4/ <https://mac.r-project.org/libs-4/> you will see a reference to 'recipes': you could simply have followed those to rebuild for macOS 11, probably only gdal.  You probably want to ensure that the libpq that libgdal links against is the one in the libpq recipe (or build without PostgreSQL support).  Please ask Simon to rebuild his gdal accordingly.
>> 5. In the order given above, unpack each library and then execute the following commands:
>> % ./configure
>> % make
>> % sudo make install
>> 6. Now you are ready to compile "rgdal" and "sf" from source. Using the R console,do:
>>> install.packages("rgdal", type = "source”)
>>> install.packages("sf", type = "source")
>> 7. After those steps, both "rgdal" and "sf" are working on MacOS BigSur.
>> Hope this helps Mac users.
>> Best
>> Gilberto
>> 	[[alternative HTML version deleted]]
> Please don't send HTML.
> -- 
> Brian D. Ripley,                  ripley using stats.ox.ac.uk <mailto:ripley using stats.ox.ac.uk>
> Emeritus Professor of Applied Statistics, University of Oxford

	[[alternative HTML version deleted]]

More information about the R-SIG-Mac mailing list