I have been having problems with vectorial spatial data for some time, mostly important to plot SpatialPolygonDataFrames (I asked here: Slow plotting SpatialPolygonDataFrames on some systems). This happens to me in a Macos laptop (MacBook Pro (Retina, 13-inch, Late 2013) with macOS Sierra 10.12.4 (16E195).

Trying to solve it, I updated all libraries related to spatial data, among them GDAL and PROJ. After reinstalling rdgal, I have noticed that when I load the library, the wrong version of PROJ.4 is loaded:

> library(rgdal)
rgdal: version: 1.2-7, (SVN revision 660)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 2.1.2, released 2016/10/24
 Path to GDAL shared files: /Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgdal/gdal
 Loaded PROJ.4 runtime: Rel. 4.9.1, 04 March 2015, [PJ_VERSION: 491]
 Path to PROJ.4 shared files: /Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgdal/proj
 Linking to sp version: 1.2-4

I am sure I have installed the version 4.9.2, and it must be properly set in PATH because if I run the command proj on the terminal I get:

MacBook-Pro:~ javierfajnolla$ proj
Rel. 4.9.2, 08 September 2015
usage: proj [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]

The version 4.9.1 is known to have some problems (although I totally do not know if my problems are at all related to those... I'm just desperate for a solution), so I think I should update it. But I have failed trying to make rgdal read the right version of it.

Does anyone know a way to do this?

EDIT: I still do not have a way to solve this issue, but I have some additional information:

  • If the plots are done in R, not RStudio, it is faster. Not as fast as in other OS, but still better. It seems that the plotting device built in RStudio is quite slow.

  • There is a workaround related with the previous point. It is possible to use a different plotting device that RStudio's, and that makes it much faster. You can open pdf() or png(), make the plot and close the connection dev.off() and you will get a file with the plot inside. Not ideal, but certainly working.

  • it might help if you add how you installed rgdal.
    – AndreJ
    Jul 5, 2017 at 15:33
  • 1
  • Thank @AndreJ, I should have detailed that. I replicated the instructions in the link that you provided and re-installed gdal using brew. Doing that, R was able to see a newer version of Proj, solving the problem detailed above. However, it seems that my plotting problems (also happening to other mac users) were not related to that, as they are still there. Now, I think it is related to the plotting device used by Rstudio and R in macOS. Here I asked about these plotting problems: gis.stackexchange.com/questions/238136/… Jul 5, 2017 at 15:53
  • I've used the Frameworks super-package (GDAL, GEOS, PROJ, SQLite and UnixImageIO frameworks) over many version from: kyngchaos.com/software/frameworks . I think your answer that included the configure.args needed to address the Homebrew alternate location is useful when the frameworks go to a non-standard location.
    – 42-
    Aug 5, 2018 at 19:34

1 Answer 1


I have been able to upgrade the versions of gdal and proj that R's recognise with the aid of brew (Homebrew, an application that runs throw the terminal and installs things for you -@https://brew.sh/index_es.html). If you have brew installed, you can run on terminal:

brew tap osgeo/osgeo4mac   # taps are repositories
brew install gdal2
#brew upgrade gdal2  # if you already has a running version of gdal installed
#brew search gdal   # to see versions of gdal available
brew install proj
#brew upgrade proj  # if you already has a running version of proj installed

After that, reinstalling rgdal should recognise the newest versions of both, but you could state the directions on where to find them:

 > install.packages('rgdal', type = "source", configure.args=c('--with-proj-include=/usr/local/include','--with-proj-lib=/usr/local/lib'))

(I took that code from @https://stackoverflow.com/questions/15248815/rgdal-package-installation)

However, I never got rid of the (autodetected) message.

> library(rgdal)
rgdal: version: 1.2-8, (SVN revision 663)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 2.1.3, released 2017/20/01
 Path to GDAL shared files: /opt/local/share/gdal
 Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
 Path to PROJ.4 shared files: (autodetected)
 Linking to sp version: 1.2-5 

Neither I solved my problems with slow plotting of spatial objects in RStudio, but I am thinking now that it could be rather a problem with the plotting device used in macOS and will ask that in a separate question.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.