devtools installation problem

Hi, I'm trying to install devtools. There were several errors in the end of the installation. When I tried library(devtools), it said there is no package called "devtools". My RStudio is uptodate. Please see ERROR from RStudio:

  • installing source package ‘processx’ ...
    ** package ‘processx’ 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 ‘processx’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/processx’
  • restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/processx’
  • installing source package ‘cli’ ...
    ** package ‘cli’ 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 ‘cli’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/cli’
  • restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/cli’
  • 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/4.0/Resources/library/rlang’
  • restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/rlang’
  • installing source package ‘callr’ ...
    ** package ‘callr’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
    namespace ‘processx’ 3.5.3 is being loaded, but >= 3.6.1 is required
    Calls: ... namespaceImportFrom -> asNamespace -> loadNamespace
    Execution halted
    ERROR: lazy loading failed for package ‘callr’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/callr’
  • restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/callr’
  • installing source package ‘lifecycle’ ...
    ** package ‘lifecycle’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
    namespace ‘rlang’ 1.0.2 is being loaded, but >= 1.0.5 is required
    Calls: ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
    Execution halted
    ERROR: lazy loading failed for package ‘lifecycle’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/lifecycle’
  • restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/lifecycle’
  • installing source package ‘pkgload’ ...
    ** package ‘pkgload’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
    namespace ‘rlang’ 1.0.2 is being loaded, but >= 1.0.3 is required
    Calls: ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
    Execution halted
    ERROR: lazy loading failed for package ‘pkgload’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/pkgload’
  • restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/pkgload’
  • installing source package ‘usethis’ ...
    ** package ‘usethis’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
    namespace ‘lifecycle’ 0.2.0 is being loaded, but >= 1.0.0 is required
    Calls: ... namespaceImportFrom -> asNamespace -> loadNamespace
    Execution halted
    ERROR: lazy loading failed for package ‘usethis’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/usethis’
  • installing source package ‘roxygen2’ ...
    ** package ‘roxygen2’ 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 ‘roxygen2’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/roxygen2’
  • restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/roxygen2’
  • installing source package ‘testthat’ ...
    ** package ‘testthat’ 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 ‘testthat’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/testthat’
  • restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/testthat’
    ERROR: dependency ‘usethis’ is not available for package ‘devtools’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/devtools’

The downloaded source packages are in
‘/private/var/folders/13/cvln23w90vz4q71mrh9fhm2h0000gn/T/RtmptMxJCe/downloaded_packages’

You might be using the latest version of RStudio but this has no effect on your R package library, RStudio is an IDE for the R programming language but they have independent versions. You are using a rather old R version so the latest package versions are available for it only as source code that requires compilation.

If you need to install the latest package version from source, then you need to install Xcode in your system (not in R) and the recommended development tools for macOS systems.
https://mac.r-project.org/tools/

Or, you could update R so you can get access to precompiled binaries which are much easier to install.

https://cran.r-project.org/bin/macosx/

Hi andresrcs,

Thank you for your help. My problem has resolved after installing the uptodate R version.

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.