devtools package installation error

install.packages("devtools")

I am facing an error that I don't know how to fix. It seems that RStudio cannot lock a directory or something. I tried running

rm -rf  ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/00LOCK-vctrs’ 

in the Terminal, but it didn't fix the problem.

Expand to see the full log here
> install.packages("devtools")
also installing the dependencies ‘pillar’, ‘vctrs’, ‘credentials’, ‘zip’, ‘lazyeval’, ‘later’, ‘fastmap’, ‘rematch2’, ‘tibble’, ‘gert’, ‘rappdirs’, ‘rex’, ‘crosstalk’, ‘promises’, ‘cachem’, ‘commonmark’, ‘waldo’, ‘usethis’, ‘covr’, ‘DT’, ‘memoise’, ‘roxygen2’, ‘testthat’

trying URL 'https://cran.rstudio.com/src/contrib/pillar_1.4.7.tar.gz'
Content type 'application/x-gzip' length 113345 bytes (110 KB)
==================================================
downloaded 110 KB

trying URL 'https://cran.rstudio.com/src/contrib/vctrs_0.3.6.tar.gz'
Content type 'application/x-gzip' length 778016 bytes (759 KB)
==================================================
downloaded 759 KB

trying URL 'https://cran.rstudio.com/src/contrib/credentials_1.3.0.tar.gz'
Content type 'application/x-gzip' length 230082 bytes (224 KB)
==================================================
downloaded 224 KB

trying URL 'https://cran.rstudio.com/src/contrib/zip_2.1.1.tar.gz'
Content type 'application/x-gzip' length 112865 bytes (110 KB)
==================================================
downloaded 110 KB

trying URL 'https://cran.rstudio.com/src/contrib/lazyeval_0.2.2.tar.gz'
Content type 'application/x-gzip' length 83482 bytes (81 KB)
==================================================
downloaded 81 KB

trying URL 'https://cran.rstudio.com/src/contrib/later_1.1.0.1.tar.gz'
Content type 'application/x-gzip' length 64221 bytes (62 KB)
==================================================
downloaded 62 KB

trying URL 'https://cran.rstudio.com/src/contrib/fastmap_1.1.0.tar.gz'
Content type 'application/x-gzip' length 44277 bytes (43 KB)
==================================================
downloaded 43 KB

trying URL 'https://cran.rstudio.com/src/contrib/rematch2_2.1.2.tar.gz'
Content type 'application/x-gzip' length 13366 bytes (13 KB)
==================================================
downloaded 13 KB

trying URL 'https://cran.rstudio.com/src/contrib/tibble_3.0.6.tar.gz'
Content type 'application/x-gzip' length 681013 bytes (665 KB)
==================================================
downloaded 665 KB

trying URL 'https://cran.rstudio.com/src/contrib/gert_1.2.0.tar.gz'
Content type 'application/x-gzip' length 66100 bytes (64 KB)
==================================================
downloaded 64 KB

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

trying URL 'https://cran.rstudio.com/src/contrib/rex_1.2.0.tar.gz'
Content type 'application/x-gzip' length 91925 bytes (89 KB)
==================================================
downloaded 89 KB

trying URL 'https://cran.rstudio.com/src/contrib/crosstalk_1.1.1.tar.gz'
Content type 'application/x-gzip' length 676543 bytes (660 KB)
==================================================
downloaded 660 KB

trying URL 'https://cran.rstudio.com/src/contrib/promises_1.2.0.1.tar.gz'
Content type 'application/x-gzip' length 3120504 bytes (3.0 MB)
==================================================
downloaded 3.0 MB

trying URL 'https://cran.rstudio.com/src/contrib/cachem_1.0.4.tar.gz'
Content type 'application/x-gzip' length 24493 bytes (23 KB)
==================================================
downloaded 23 KB

trying URL 'https://cran.rstudio.com/src/contrib/commonmark_1.7.tar.gz'
Content type 'application/x-gzip' length 134002 bytes (130 KB)
==================================================
downloaded 130 KB

trying URL 'https://cran.rstudio.com/src/contrib/waldo_0.2.4.tar.gz'
Content type 'application/x-gzip' length 26226 bytes (25 KB)
==================================================
downloaded 25 KB

trying URL 'https://cran.rstudio.com/src/contrib/usethis_2.0.1.tar.gz'
Content type 'application/x-gzip' length 306090 bytes (298 KB)
==================================================
downloaded 298 KB

trying URL 'https://cran.rstudio.com/src/contrib/covr_3.5.1.tar.gz'
Content type 'application/x-gzip' length 146686 bytes (143 KB)
==================================================
downloaded 143 KB

trying URL 'https://cran.rstudio.com/src/contrib/DT_0.17.tar.gz'
Content type 'application/x-gzip' length 1583156 bytes (1.5 MB)
==================================================
downloaded 1.5 MB

trying URL 'https://cran.rstudio.com/src/contrib/memoise_2.0.0.tar.gz'
Content type 'application/x-gzip' length 17337 bytes (16 KB)
==================================================
downloaded 16 KB

trying URL 'https://cran.rstudio.com/src/contrib/roxygen2_7.1.1.tar.gz'
Content type 'application/x-gzip' length 254118 bytes (248 KB)
==================================================
downloaded 248 KB

trying URL 'https://cran.rstudio.com/src/contrib/testthat_3.0.2.tar.gz'
Content type 'application/x-gzip' length 680365 bytes (664 KB)
==================================================
downloaded 664 KB

trying URL 'https://cran.rstudio.com/src/contrib/devtools_2.3.2.tar.gz'
Content type 'application/x-gzip' length 373387 bytes (364 KB)
==================================================
downloaded 364 KB

ERROR: failed to lock directory ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library’ for modifying
Try removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/00LOCK-vctrs’
Warning in install.packages :
  installation of package ‘vctrs’ had non-zero exit status
* installing *source* package ‘credentials’ ...
** package ‘credentials’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: package or namespace load failed for ‘credentials’:
 .onLoad failed in loadNamespace() for 'credentials', details:
  call: NULL
  error: Failed to call 'git help -a'
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/credentials’
Warning in install.packages :
  installation of package ‘credentials’ had non-zero exit status
* installing *source* package ‘zip’ ...
** package ‘zip’ 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 ‘zip’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/zip’
Warning in install.packages :
  installation of package ‘zip’ had non-zero exit status
* installing *source* package ‘lazyeval’ ...
** package ‘lazyeval’ 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 ‘lazyeval’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/lazyeval’
Warning in install.packages :
  installation of package ‘lazyeval’ had non-zero exit status
* installing *source* package ‘later’ ...
** package ‘later’ successfully unpacked and MD5 sums checked
** using staged installation
Running configure script
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
-latomic linker flag needed.
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘later’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/later’
Warning in install.packages :
  installation of package ‘later’ had non-zero exit status
* installing *source* package ‘fastmap’ ...
** package ‘fastmap’ 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 ‘fastmap’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/fastmap’
Warning in install.packages :
  installation of package ‘fastmap’ had non-zero exit status
* installing *source* package ‘rappdirs’ ...
** package ‘rappdirs’ 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 ‘rappdirs’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/rappdirs’
Warning in install.packages :
  installation of package ‘rappdirs’ had non-zero exit status
* installing *source* package ‘commonmark’ ...
** package ‘commonmark’ 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 ‘commonmark’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/commonmark’
Warning in install.packages :
  installation of package ‘commonmark’ had non-zero exit status
ERROR: dependency ‘vctrs’ is not available for package ‘pillar’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/pillar’
Warning in install.packages :
  installation of package ‘pillar’ had non-zero exit status
ERROR: dependencies ‘credentials’, ‘zip’ are not available for package ‘gert’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/gert’
Warning in install.packages :
  installation of package ‘gert’ had non-zero exit status
ERROR: dependency ‘lazyeval’ is not available for package ‘rex’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/rex’
Warning in install.packages :
  installation of package ‘rex’ had non-zero exit status
ERROR: dependency ‘lazyeval’ is not available for package ‘crosstalk’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/crosstalk’
Warning in install.packages :
  installation of package ‘crosstalk’ had non-zero exit status
ERROR: dependency ‘later’ is not available for package ‘promises’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/promises’
Warning in install.packages :
  installation of package ‘promises’ had non-zero exit status
ERROR: dependency ‘fastmap’ is not available for package ‘cachem’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/cachem’
Warning in install.packages :
  installation of package ‘cachem’ had non-zero exit status
ERROR: dependency ‘commonmark’ is not available for package ‘roxygen2’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/roxygen2’
Warning in install.packages :
  installation of package ‘roxygen2’ had non-zero exit status
ERROR: dependencies ‘pillar’, ‘vctrs’ are not available for package ‘tibble’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/tibble’
Warning in install.packages :
  installation of package ‘tibble’ had non-zero exit status
ERROR: dependencies ‘gert’, ‘rappdirs’ are not available for package ‘usethis’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/usethis’
Warning in install.packages :
  installation of package ‘usethis’ had non-zero exit status
ERROR: dependency ‘rex’ is not available for package ‘covr’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/covr’
Warning in install.packages :
  installation of package ‘covr’ had non-zero exit status
ERROR: dependencies ‘crosstalk’, ‘promises’ are not available for package ‘DT’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/DT’
Warning in install.packages :
  installation of package ‘DT’ had non-zero exit status
ERROR: dependency ‘cachem’ is not available for package ‘memoise’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/memoise’
Warning in install.packages :
  installation of package ‘memoise’ had non-zero exit status
ERROR: dependency ‘tibble’ is not available for package ‘rematch2’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/rematch2’
Warning in install.packages :
  installation of package ‘rematch2’ had non-zero exit status
ERROR: dependencies ‘rematch2’, ‘tibble’ are not available for package ‘waldo’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/waldo’
Warning in install.packages :
  installation of package ‘waldo’ had non-zero exit status
ERROR: dependency ‘waldo’ is not available for package ‘testthat’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/testthat’
Warning in install.packages :
  installation of package ‘testthat’ had non-zero exit status
ERROR: dependencies ‘usethis’, ‘covr’, ‘DT’, ‘memoise’, ‘roxygen2’, ‘testthat’ are not available for package ‘devtools’
* removing ‘/usr/local/Cellar/r/4.0.3_2/lib/R/library/devtools’
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/zp/47lcfy9x6kv78k2ylj05vynr0000gn/T/RtmpcXB5H8/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
> 

You are missing xcode in your system

If you need to install packages from source, then you need to install Xcode in your system (not in R) and the recommended development tools for macOS systems.

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