xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun ERROR: compilation failed for package ‘rlang’

Hey folks,

I'm fairly new to Rstudio but I think I am having similar troubles. When I try to load dplyr I get the following error (apologizes if this post doesn't format correctly):

library(dplyr)
Error: package or namespace load failed for ‘dplyr’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): namespace ‘rlang’ 0.3.0.1 is already loaded, but >= >= 0.3.1 is required

should I also do the same reinstallation procedure to fix my situation?

I don't think it's necessary, just try updating rlang package.

install.packages("rlang")
1 Like

Unfortunately, it didn't work. Still get the same error for dplyr.

Restarting R session...

> install.packages("rlang")

  There is a binary version available but the source version is later:
      binary source needs_compilation
rlang  0.3.1  0.3.3              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) y
installing the source package ‘rlang’

trying URL 'https://cran.rstudio.com/src/contrib/rlang_0.3.3.tar.gz'
Content type 'application/x-gzip' length 859027 bytes (838 KB)
==================================================
downloaded 838 KB

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

The downloaded source packages are in
	‘/private/var/folders/dv/q61b2y795bbcs2kkg7zqq_qm0000gn/T/RtmpjefZx7/downloaded_packages’
> library("dplyr", lib.loc="/Library/Frameworks/R.framework/Versions/3.5/Resources/library")
Error: package or namespace load failed for ‘dplyr’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 namespace ‘rlang’ 0.3.0.1 is already loaded, but >= 0.3.1 is required
In addition: Warning message:
package ‘dplyr’ was built under R version 3.5.2 
> library("rlang", lib.loc="/Library/Frameworks/R.framework/Versions/3.5/Resources/library")
> library(dplyr)
Error: package or namespace load failed for ‘dplyr’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 namespace ‘rlang’ 0.3.0.1 is already loaded, but >= 0.3.1 is required
In addition: Warning message:
package ‘dplyr’ was built under R version 3.5.2 

If I read your second set of errors correctly, the key message about failing to update rlang is

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘rlang’

I'm pretty sure this indicates your using a mac, and need to install xcode. Here are step by step instructions

Once youve got xcode, retry updating rlang, and then dplyr. :crossed_fingers:t4:

2 Likes

I think it worked! Thanks @EconomiCurtis :+1:t5:

1 Like

This topic was automatically closed 7 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.