I have literally the same problem as this person, yet the proposed solution doesn't seem to work.

I've been using R Studio for years now, but quite literally the same happened. Tried to install plotly for some homework I had, it wouldn't allow me. The error message being showed was:

Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘rlang’ 0.4.5 is being loaded, but >= 0.4.10 is required
ERROR: lazy loading failed for package ‘lifecycle’

  • removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/lifecycle

So I decided I should install the lifecycle package, then a different version of the same error appeared:

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

Now I tried to update the "Rlang" package, it would give me the same error status update:

Warning in install.packages :
installation of package ‘rlang’ had non-zero exit status

So I come here asking for any recommendations/comments/suggestions as for what I could do ):

I'm using MAC OS too, and have already tried to reinstall R with no change in the error response.

Thanks in advance

JABS

Macos has its distinct peculiarities in R. I recommend searching for a guide to R that covers installing Xcode, which is an macos requirement when compiling binaries from source.

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

On MacOS, to install from source, you need to both INSTALL the then-current version of Apple's XCode AND to run it to install the command line tools.

Without the command line tools installed on first run, XCode can't run gcc etc. when R tries to compile. That's likely where your "non-zero exit" is coming from.

You (may) need to re-do this after all XCode installations and updates.

  1. Download and install XCode from the Mac AppStore: http://itunes.apple.com/us/app/xcode/id497799835?mt=12
  2. Within XCode go to Preferences : Downloads and install the Command Line Tools