Unable to install rlang v0.4.1

I've tried to install rlang package in Rstudio (v3.6.1), but I got the following error message:

  • installing source package ‘rlang’ ...
    ** package ‘rlang’ 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 ‘rlang’
  • removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rlang’
    Warning in install.packages :
    installation of package ‘rlang’ had non-zero exit status

Does anybody know how to fix this problem? Please share your solution, thanks!

(Additional Info:
macOS Catalina Version 10.15)

Do you have xcode installed in your system? You need it for compiling packages on MacOS

xcode-select --install

Here are some installation instructions

I have Xcode Version 11.2 (11B52) on my computer.

This part suggests problems with your xcode installation, try reinstalling/updating.

I reinstalled the Xcode last night and I tried the install.package ("testthat") through the Rstudio and Terminal. But I still got warning message like this:

Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
  unable to load shared object '/Library/Frameworks/R.framework/Resources/modules//R_X11.so':
  dlopen(/Library/Frameworks/R.framework/Resources/modules//R_X11.so, 6): Library not loaded: /opt/X11/lib/libSM.6.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/modules/R_X11.so
  Reason: image not found
2: In install.packages("testthat") :
  installation of package ‘digest’ had non-zero exit status
3: In install.packages("testthat") :
  installation of package ‘rlang’ had non-zero exit status

That is a different problem, it seems like you are also missing xquartz in your system


I have the V2.7.11 XQuartz installed on my Mac, but it still can't work. BTW, I'm on Catalina now. Will this be a problem?


xcode-select --install

I installed the xocde-select and it solved the issue. Thanks!

Great! Please mark this as the solution for the benefit of future pilgrims.

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