ERROR: compilation failed for package ‘rlang'

Hi, I'm trying to use ggplot2 on R studio but I'm getting an error when it comes to installing 'rlang' which seems to be required. here's my problem:

  • 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’
    Warning in install.packages :
    installation of package ‘rlang’ had non-zero exit status

I have the latest version of RStudio on Mac and also tried removing ggplot2 and reinstalling and also using tidy verse but I keep getting the same error with rlang. Any help would be highly appreciated. Thank you

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

xcode-select --install
2 Likes

This solved my problem, I'm still a newbie at coding, thank you andre :slight_smile:

Hi
I'm having a similar, but not exactly the same problem. I'm on a Mac (10.14.3) and downloaded 3.5.3 patched. I can't seem to download rlang, and that means I can't download car either. The rest seems to work. When I tried to install xcode, it said it wasn't available for this version. Not sure where to go next. Thanks for any help - I think I'm at the stage (pre-newbie) :wink:

  • installing source package ‘rlang’ ...
    ** package ‘rlang’ successfully unpacked and MD5 sums checked
    ** libs
    xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
    ERROR: compilation failed for package ‘rlang’
  • removing ‘/Users/chunter/Library/R/3.5/library/rlang’

The downloaded source packages are in
‘/private/var/folders/kc/kmbnyf3d13l_lmfmdcmjwwnw9k_jfq/T/RtmpQ1omml/downloaded_packages’
Warning message:
In install.packages("rlang") :
installation of package ‘rlang’ had non-zero exit status

xcode --install
Error: object 'xcode' not found

xcode--install
Error: object 'xcode' not found
install.packages("xcode")
Installing package into ‘/Users/chunter/Library/R/3.5/library’
(as ‘lib’ is unspecified)
Warning message:
package ‘xcode’ is not available (for R version 3.5.3 Patched)

xcode is not a R library it's a system library, you need to install it this way

Thanks for the super quick reply...
I managed to follow that, but then get a message, 'Can't install the software because it is not currently available from the Software Update server'.

You need to do it in terminal and not on R

Thanks - OK, so I needed to install it from the app store, but that's in now and it helped with rlang. But...
Now (following instructions) I need to start Rcmdr. This is what I get...

library(Rcmdr)
Error: package or namespace load failed for 'Rcmdr':
.onAttach failed in attachNamespace() for 'Rcmdr', details:
call: structure(.External(.C_dotTclObjv, objv), class = "tclObj")
error: [tcl] invalid command name "image".

Do you have installed Rcmdr after installing rlang?

Install.packages(Rcmdr)

Yep. And just tried to again reinstall. I still get errors, but now it's slightly different. I could interpret it when it was just missing packages, but have no idea how to interpret what is wrong here, and what needs to be done. I really do appreciate the super fast help on this forum - incredible. And I should add re-reading your post - I'm not sure which I've done first. I've been going back and forth with installing packages. I THINK the order I did it in was, R, some additional packages, RCmdr, rlang, car, RCmdr.....AAARGH!!! Do I need to start again from scratch?

library(Rcmdr)
Loading required package: splines
Loading required package: RcmdrMisc
Loading required package: car
Loading required package: carData
Loading required package: sandwich
Loading required package: effects
lattice theme set by effectsTheme()
See ?effectsTheme for details.
Error: package or namespace load failed for 'Rcmdr':
.onAttach failed in attachNamespace() for 'Rcmdr', details:
call: structure(.External(.C_dotTclObjv, objv), class = "tclObj")
error: [tcl] invalid command name "image".
In addition: Warning message:
In fun(libname, pkgname) : couldn't connect to display ":0"

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