Error installing haven package on OS X Catalina 10.15.3

Hi there, I keep running into errors when trying to install 'haven' on my Mac OS (updated to the newest version of Catalina) on the latest version of R studio. I get this message:

> install.packages('haven') #Allows loading other file types
also installing the dependency ‘Rcpp’

  There is a binary version available but the source version is later:
     binary  source needs_compilation
Rcpp  1.0.4              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes

trying URL ''
Content type 'application/x-gzip' length 1077133 bytes (1.0 MB)
downloaded 1.0 MB

The downloaded binary packages are in
installing the source package ‘Rcpp’

trying URL ''
Content type 'application/x-gzip' length 2751467 bytes (2.6 MB)
downloaded 2.6 MB

* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp’
Warning in install.packages :
  installation of package ‘Rcpp’ had non-zero exit status

The downloaded source packages are in

Can someone please help with this?

1 Like

The easiest solution would be to answer "no" to this question, you would get a precompiled binary version that is a little older but much easier to install.
If you need to install the latest version from source, then you need to install Xcode in your system (not in R) and the recommended development tools for macOS systems.

1 Like

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