Can't install devtools because directory not writeable

I’m trying to follow the install instructions for CmdStanR and the first step fails:

> install.packages("devtools")
Warning in install.packages("devtools") :
  'lib = "/Library/Frameworks/R.framework/Versions/3.5/Resources/library"' is not writable
Would you like to use a personal library instead? (yes/No/cancel) 

I just migrated from my old Macbook to a new Macbook with upgraded OS. My system reports Catalina 10.15.2.

RStan still works.

Any suggestions as to how I should proceed?

R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.15.2

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rstan_2.19.2          ggplot2_3.1.0         StanHeaders_2.18.1-10

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18       pillar_1.2.3       compiler_3.5.0     plyr_1.8.4        
 [5] bindr_0.1.1        prettyunits_1.0.2  base64enc_0.1-3    tools_3.5.0       
 [9] digest_0.6.15      pkgbuild_1.0.2     tibble_1.4.2       gtable_0.2.0      
[13] pkgconfig_2.0.2    rlang_0.4.0        cli_1.0.0          parallel_3.5.0    
[17] loo_2.0.0          bindrcpp_0.2.2     gridExtra_2.3      withr_2.1.2       
[21] dplyr_0.7.6        stats4_3.5.0       grid_3.5.0         tidyselect_0.2.4  
[25] glue_1.2.0         inline_0.3.15      R6_2.2.2           processx_3.2.0    
[29] callr_3.0.0        purrr_0.2.5        magrittr_1.5       scales_0.5.0      
[33] ps_1.2.0           codetools_0.2-15   matrixStats_0.54.0 assertthat_0.2.0  
[37] colorspace_1.3-2   labeling_0.3       lazyeval_0.2.1     munsell_0.4.3     
[41] crayon_1.3.4      
1 Like

By default install.packages uses the first entry in .libPaths(), but for you that’s a system folder. Just say Yes when you are asked to create a personal library. The package will be installed within your home directory.

1 Like

In my .Renviron file I have


to specify the path accessible to me.