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 1.0.4.6              TRUE

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

trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/haven_2.2.0.tgz'
Content type 'application/x-gzip' length 1077133 bytes (1.0 MB)
==================================================
downloaded 1.0 MB


The downloaded binary packages are in
	/var/folders/3k/xp5hc__50hbfzhyrfzcwn1wc0000gn/T//RtmpIBzN3p/downloaded_packages
installing the source package ‘Rcpp’

trying URL 'https://cran.rstudio.com/src/contrib/Rcpp_1.0.4.6.tar.gz'
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
	‘/private/var/folders/3k/xp5hc__50hbfzhyrfzcwn1wc0000gn/T/RtmpIBzN3p/downloaded_packages’

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.
https://cran.r-project.org/bin/macosx/tools/

1 Like

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