-2
install.packages("tidyverse") 
Installing package into ‘/Users/user/Library/R/3.3/library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘callr’, ‘reprex’

There are binary versions available but the source versions
  are later:
          binary source needs_compilation
callr      1.0.0  2.0.3             FALSE
tidyverse  1.1.1  1.2.1             FALSE

installing the source packages ‘callr’, ‘reprex’, ‘tidyverse’

trying URL 'https://cran.rstudio.com/src/contrib/callr_2.0.3.tar.gz'
Content type 'application/x-gzip' length 97453 bytes (95 KB)
==================================================
downloaded 95 KB

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

trying URL 'https://cran.rstudio.com/src/contrib/tidyverse_1.2.1.tar.gz'
Content type 'application/x-gzip' length 61647 bytes (60 KB)
==================================================
downloaded 60 KB

* installing *source* package ‘callr’ ...
** package ‘callr’ 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 ‘callr’
* removing ‘/Users/user/Library/R/3.3/library/callr’

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

ERROR: dependency ‘callr’ is not available for package ‘reprex’
* removing ‘/Users/user/Library/R/3.3/library/reprex’

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

ERROR: dependency ‘reprex’ is not available for package ‘tidyverse’
* removing ‘/Users/user/Library/R/3.3/library/tidyverse’

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

The downloaded source packages are in
    ‘/private/var/folders/mt/kdpgc7xx7nl4wl2g43877jb80000gn/T/RtmpSJkXIU/downloaded_packages’

> library(tidyverse)
Error in library(tidyverse) : there is no package called ‘tidyverse’
Agaz Wani
  • 5,514
  • 8
  • 42
  • 62
user2550361
  • 3
  • 1
  • 6
  • Searching for the term '`xcrun: error: invalid active developer path`' led me to this post which might help: https://apple.stackexchange.com/questions/254380/macos-sierra-invalid-active-developer-path – Phil Apr 17 '18 at 12:03

2 Answers2

2

You have the non-zero exit status error. That's answered in another R thread. which just means there was an error during installation. Specifically, the packages callr and reprex did not install. These are required packages for tidyverse which then subsequently did not install.

Generally it works for me after I restart the computer and try again. You can also try installing the callr and reprex packages individually before installing tidyverse.

As a last resort, you can search for the archive with the functions part of 'tidyverse' online and load them into R manually. This doesn't install the functions as part of a package but ends them into your global environment to make them available temporarily.

MBorg
  • 1,345
  • 2
  • 19
  • 38
0

I resolved the problem as follows:

  1. I update my R to version 3.4.4
  2. I then use : install.packages("tidyverse", dependencies=TRUE) as explained here : Having trouble installing and loading tidyverse
user2550361
  • 3
  • 1
  • 6