What has happened to make my library() just never work?

Hi there everybody, hoping somebody can help me:

I've used R plenty in the past, for specific things to do with phylogenetics (my main area of study) and data manipulation. I am now trying to teach myself some ggplot2 to produce some lovely results, but I have come across an issue that is driving me crazy, which I have never had trouble with previously.

When I began training i tried to install.packages("ggplot2") which seemed to work fine
but then library(ggplot2) just doesn't work and I end up getting the error message:
'Error in library(ggplot2) : there is no package called ‘ggplot2’

I have since found this to be the case for every package that I had previously run, I cannot get a single package to install and run in R now!

I have since deleted and reinstalled R and RStudio twice, to no avail.
I am working on macOS Catalina v10.15.3, having recently moved to use my laptop wfh with the covid-19 situation.

I'm pulling my hair out cos i can't get anything done! hopefully someone out there can help.

Thanks a bunch!

Hi @phyloR, could share a screenshot of your RStudio window, with the 'Packages' tab in the lower right visible?

sure, hope this is exactly what you need

If you can't load the package then it has not been successfully installed.
Try to install again and post here the messages you get.

R_code install.packages("ggplot2")
also installing the dependencies ‘ps’, ‘processx’, ‘callr’, ‘backports’, ‘desc’, ‘pkgbuild’, ‘rprojroot’, ‘ellipsis’, ‘pkgload’, ‘colorspace’, ‘utf8’, ‘vctrs’, ‘Rcpp’, ‘testthat’, ‘farver’, ‘munsell’, ‘lifecycle’, ‘cli’, ‘fansi’, ‘pillar’, ‘digest’, ‘glue’, ‘isoband’, ‘rlang’, ‘scales’, ‘tibble’

Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6:
  cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/PACKAGES'
Packages which are only available in source form, and may need compilation of C/C++/Fortran: ‘ps’ ‘processx’ ‘backports’ ‘ellipsis’ ‘pkgload’ ‘colorspace’ ‘utf8’
  ‘vctrs’ ‘Rcpp’ ‘testthat’ ‘farver’ ‘fansi’ ‘digest’ ‘glue’ ‘isoband’ ‘rlang’ ‘tibble’
Do you want to attempt to install these from sources? (Yes/no/cancel) yes
installing the source packages ‘ps’, ‘processx’, ‘callr’, ‘backports’, ‘desc’, ‘pkgbuild’, ‘rprojroot’, ‘ellipsis’, ‘pkgload’, ‘colorspace’, ‘utf8’, ‘vctrs’, ‘Rcpp’, ‘testthat’, ‘farver’, ‘munsell’, ‘lifecycle’, ‘cli’, ‘fansi’, ‘pillar’, ‘digest’, ‘glue’, ‘isoband’, ‘rlang’, ‘scales’, ‘tibble’, ‘ggplot2’

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

trying URL 'https://cran.rstudio.com/src/contrib/processx_3.4.2.tar.gz'
Content type 'application/x-gzip' length 130148 bytes (127 KB)
==================================================
downloaded 127 KB

trying URL 'https://cran.rstudio.com/src/contrib/callr_3.4.2.tar.gz'
Content type 'application/x-gzip' length 85454 bytes (83 KB)
==================================================
downloaded 83 KB

trying URL 'https://cran.rstudio.com/src/contrib/backports_1.1.5.tar.gz'
Content type 'application/x-gzip' length 14798 bytes (14 KB)
==================================================
downloaded 14 KB

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

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

trying URL 'https://cran.rstudio.com/src/contrib/rprojroot_1.3-2.tar.gz'
Content type 'application/x-gzip' length 50414 bytes (49 KB)
==================================================
downloaded 49 KB

trying URL 'https://cran.rstudio.com/src/contrib/ellipsis_0.3.0.tar.gz'
Content type 'application/x-gzip' length 7371 bytes
==================================================
downloaded 7371 bytes

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

trying URL 'https://cran.rstudio.com/src/contrib/colorspace_1.4-1.tar.gz'
Content type 'application/x-gzip' length 2152594 bytes (2.1 MB)
==================================================
downloaded 2.1 MB

trying URL 'https://cran.rstudio.com/src/contrib/utf8_1.1.4.tar.gz'
Content type 'application/x-gzip' length 218882 bytes (213 KB)
==================================================
downloaded 213 KB

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

trying URL 'https://cran.rstudio.com/src/contrib/Rcpp_1.0.4.tar.gz'
Content type 'application/x-gzip' length 2750216 bytes (2.6 MB)
==================================================
downloaded 2.6 MB

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

trying URL 'https://cran.rstudio.com/src/contrib/farver_2.0.3.tar.gz'
Content type 'application/x-gzip' length 1279579 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

trying URL 'https://cran.rstudio.com/src/contrib/munsell_0.5.0.tar.gz'
Content type 'application/x-gzip' length 182653 bytes (178 KB)
==================================================
downloaded 178 KB

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

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

trying URL 'https://cran.rstudio.com/src/contrib/fansi_0.4.1.tar.gz'
Content type 'application/x-gzip' length 270906 bytes (264 KB)
==================================================
downloaded 264 KB

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

trying URL 'https://cran.rstudio.com/src/contrib/digest_0.6.25.tar.gz'
Content type 'application/x-gzip' length 145642 bytes (142 KB)
==================================================
downloaded 142 KB

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

trying URL 'https://cran.rstudio.com/src/contrib/isoband_0.2.0.tar.gz'
Content type 'application/x-gzip' length 1894070 bytes (1.8 MB)
==================================================
downloaded 1.8 MB

trying URL 'https://cran.rstudio.com/src/contrib/rlang_0.4.5.tar.gz'
Content type 'application/x-gzip' length 816813 bytes (797 KB)
==================================================
downloaded 797 KB

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

trying URL 'https://cran.rstudio.com/src/contrib/tibble_2.1.3.tar.gz'
Content type 'application/x-gzip' length 310774 bytes (303 KB)
==================================================
downloaded 303 KB

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

* installing *source* package ‘ps’ ...
** package ‘ps’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -Wall -g -O2  -Wall px.c -o px
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c init.c -o init.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
init.c:6:10: fatal error: 'stdlib.h' file not found
#include <stdlib.h>
         ^~~~~~~~~~
1 error generated.
make: *** [init.o] Error 1
ERROR: compilation failed for package ‘ps’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/ps’
Warning in install.packages :
  installation of package ‘ps’ had non-zero exit status
* installing *source* package ‘backports’ ...
** package ‘backports’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c dotsElt.c -o dotsElt.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from dotsElt.c:1:
/Library/Frameworks/R.framework/Resources/include/R.h:55:11: fatal error: 'stdlib.h' file not found
# include <stdlib.h> /* Not used by R itself, but widely assumed in packages */
          ^~~~~~~~~~
1 error generated.
make: *** [dotsElt.o] Error 1
ERROR: compilation failed for package ‘backports’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/backports’
Warning in install.packages :
  installation of package ‘backports’ had non-zero exit status
* installing *source* package ‘colorspace’ ...
** package ‘colorspace’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c colorspace.c -o colorspace.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
colorspace.c:2:10: fatal error: 'ctype.h' file not found
#include <ctype.h>
         ^~~~~~~~~
1 error generated.
make: *** [colorspace.o] Error 1
ERROR: compilation failed for package ‘colorspace’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/colorspace’
Warning in install.packages :
  installation of package ‘colorspace’ had non-zero exit status
* installing *source* package ‘utf8’ ...
** package ‘utf8’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -Iutf8lite/src -fPIC  -Wall -g -O2  -c as_utf8.c -o as_utf8.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
as_utf8.c:17:10: fatal error: 'assert.h' file not found
#include <assert.h>
         ^~~~~~~~~~
1 error generated.
make: *** [as_utf8.o] Error 1
ERROR: compilation failed for package ‘utf8’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/utf8’
Warning in install.packages :
  installation of package ‘utf8’ had non-zero exit status
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c api.cpp -o api.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from api.cpp:24:
In file included from ../inst/include/Rcpp.h:27:
In file included from ../inst/include/RcppCommon.h:29:
In file included from ../inst/include/Rcpp/r/headers.h:67:
In file included from ../inst/include/Rcpp/platform/compiler.h:100:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:305:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/math.h:301:15: fatal error: 'math.h' file not found
#include_next <math.h>
              ^~~~~~~~
1 error generated.
make: *** [api.o] Error 1
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp’
Warning in install.packages :
  installation of package ‘Rcpp’ had non-zero exit status
* installing *source* package ‘farver’ ...
** package ‘farver’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c ColorSpace.cpp -o ColorSpace.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from ColorSpace.cpp:1:
In file included from ./ColorSpace.h:4:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/exception:82:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstdlib:86:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:94:15: fatal error: 'stdlib.h' file not found
#include_next <stdlib.h>
              ^~~~~~~~~~
1 error generated.
make: *** [ColorSpace.o] Error 1
ERROR: compilation failed for package ‘farver’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/farver’
Warning in install.packages :
  installation of package ‘farver’ had non-zero exit status
* installing *source* package ‘fansi’ ...
** package ‘fansi’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c assumptions.c -o assumptions.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from assumptions.c:21:
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:39:11: fatal error: 'stdio.h' file not found
# include <stdio.h>
          ^~~~~~~~~
1 error generated.
make: *** [assumptions.o] Error 1
ERROR: compilation failed for package ‘fansi’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/fansi’
Warning in install.packages :
  installation of package ‘fansi’ had non-zero exit status
* installing *source* package ‘digest’ ...
** package ‘digest’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c SpookyV2.cpp -o SpookyV2.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
SpookyV2.cpp:14:10: fatal error: 'memory.h' file not found
#include <memory.h>
         ^~~~~~~~~~
1 error generated.
make: *** [SpookyV2.o] Error 1
ERROR: compilation failed for package ‘digest’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/digest’
Warning in install.packages :
  installation of package ‘digest’ had non-zero exit status
* installing *source* package ‘glue’ ...
** package ‘glue’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c glue.c -o glue.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from glue.c:1:
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:39:11: fatal error: 'stdio.h' file not found
# include <stdio.h>
          ^~~~~~~~~
1 error generated.
make: *** [glue.o] Error 1
ERROR: compilation failed for package ‘glue’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/glue’
Warning in install.packages :
  installation of package ‘glue’ had non-zero exit status
* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I./lib/  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c capture.c -o capture.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from capture.c:1:
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:39:11: fatal error: 'stdio.h' file not found
# include <stdio.h>
          ^~~~~~~~~
1 error generated.
make: *** [capture.o] Error 1
ERROR: compilation failed for package ‘rlang’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rlang’
Warning in install.packages :
  installation of package ‘rlang’ had non-zero exit status
ERROR: dependency ‘ps’ is not available for package ‘processx’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/processx’
Warning in install.packages :
  installation of package ‘processx’ had non-zero exit status
ERROR: dependency ‘backports’ is not available for package ‘rprojroot’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rprojroot’
Warning in install.packages :
  installation of package ‘rprojroot’ had non-zero exit status
ERROR: dependency ‘rlang’ is not available for package ‘ellipsis’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/ellipsis’
Warning in install.packages :
  installation of package ‘ellipsis’ had non-zero exit status
ERROR: dependency ‘colorspace’ is not available for package ‘munsell’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/munsell’
Warning in install.packages :
  installation of package ‘munsell’ had non-zero exit status
ERROR: dependencies ‘glue’, ‘rlang’ are not available for package ‘lifecycle’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/lifecycle’
Warning in install.packages :
  installation of package ‘lifecycle’ had non-zero exit status
ERROR: dependencies ‘glue’, ‘fansi’ are not available for package ‘cli’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/cli’
Warning in install.packages :
  installation of package ‘cli’ had non-zero exit status
ERROR: dependency ‘processx’ is not available for package ‘callr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/callr’
Warning in install.packages :
  installation of package ‘callr’ had non-zero exit status
ERROR: dependency ‘rprojroot’ is not available for package ‘desc’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/desc’
Warning in install.packages :
  installation of package ‘desc’ had non-zero exit status
ERROR: dependencies ‘ellipsis’, ‘digest’, ‘glue’, ‘rlang’ are not available for package ‘vctrs’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/vctrs’
Warning in install.packages :
  installation of package ‘vctrs’ had non-zero exit status
ERROR: dependencies ‘farver’, ‘munsell’, ‘lifecycle’ are not available for package ‘scales’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/scales’
Warning in install.packages :
  installation of package ‘scales’ had non-zero exit status
ERROR: dependencies ‘callr’, ‘cli’, ‘desc’, ‘rprojroot’ are not available for package ‘pkgbuild’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/pkgbuild’
Warning in install.packages :
  installation of package ‘pkgbuild’ had non-zero exit status
ERROR: dependencies ‘cli’, ‘fansi’, ‘rlang’, ‘utf8’, ‘vctrs’ are not available for package ‘pillar’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/pillar’
Warning in install.packages :
  installation of package ‘pillar’ had non-zero exit status
ERROR: dependencies ‘desc’, ‘pkgbuild’, ‘rlang’, ‘rprojroot’ are not available for package ‘pkgload’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/pkgload’
Warning in install.packages :
  installation of package ‘pkgload’ had non-zero exit status
ERROR: dependencies ‘cli’, ‘fansi’, ‘pillar’, ‘rlang’ are not available for package ‘tibble’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/tibble’
Warning in install.packages :
  installation of package ‘tibble’ had non-zero exit status
ERROR: dependencies ‘cli’, ‘digest’, ‘ellipsis’, ‘pkgload’, ‘rlang’ are not available for package ‘testthat’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/testthat’
Warning in install.packages :
  installation of package ‘testthat’ had non-zero exit status
ERROR: dependencies ‘Rcpp’, ‘testthat’ are not available for package ‘isoband’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/isoband’
Warning in install.packages :
  installation of package ‘isoband’ had non-zero exit status
ERROR: dependencies ‘digest’, ‘glue’, ‘isoband’, ‘rlang’, ‘scales’, ‘tibble’ are not available for package ‘ggplot2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/ggplot2’
Warning in install.packages :
  installation of package ‘ggplot2’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/y1/hqdp0znj0hqd3hv020557l8h0000gp/T/RtmpQHZ78C/downloaded_packages’

The package has not been successfully installed, you get a lot of error messages. Try reinstalling xcode in your system (not in R) and installing the recommended development tools as per the CRAN documentation.
https://cran.r-project.org/bin/macosx/tools/

thanks i'll get on that now

Also, if all you want (at the moment) is to work on exercise to learn how to use ggplot(), you could run install.packages('tidyverse', type = 'binary') first, and then do more as you need to.

great thanks, hopefully this will all work as seems my version of R doesn't like binary versions:

install.packages("tidyverse", type = 'binary')
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6:
  cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/PACKAGES'

   package ‘tidyverse’ is available as a source package but not as a binary

Warning in install.packages :
  package ‘tidyverse’ is not available (as a binary package for R version 3.6.3)

Could you post the output to sessionInfo()?

sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.3

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

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

loaded via a namespace (and not attached):
[1] compiler_3.6.3 tools_3.6.3

done all this now and seemed to make no difference, again tidyverse wasn't being installed properly. lots of errors on the outputs again:


clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c colorspace.c -o colorspace.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
colorspace.c:2:10: fatal error: 'ctype.h' file not found
#include <ctype.h>
         ^~~~~~~~~
1 error generated.
make: *** [colorspace.o] Error 1
ERROR: compilation failed for package ‘colorspace’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/colorspace’
Warning in install.packages :
  installation of package ‘colorspace’ had non-zero exit status
* installing *source* package ‘sys’ ...
** package ‘sys’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c exec.c -o exec.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from exec.c:6:
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:39:11: fatal error: 'stdio.h' file not found
# include <stdio.h>
          ^~~~~~~~~
1 error generated.
make: *** [exec.o] Error 1
ERROR: compilation failed for package ‘sys’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/sys’
Warning in install.packages :
  installation of package ‘sys’ had non-zero exit status
* installing *source* package ‘ps’ ...
** package ‘ps’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -Wall -g -O2  -Wall px.c -o px
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c init.c -o init.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
init.c:6:10: fatal error: 'stdlib.h' file not found
#include <stdlib.h>
         ^~~~~~~~~~
1 error generated.
make: *** [init.o] Error 1
ERROR: compilation failed for package ‘ps’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/ps’
Warning in install.packages :
  installation of package ‘ps’ had non-zero exit status
* installing *source* package ‘farver’ ...
** package ‘farver’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c ColorSpace.cpp -o ColorSpace.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from ColorSpace.cpp:1:
In file included from ./ColorSpace.h:4:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/typeinfo:60:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/exception:81:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstdlib:85:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdlib.h:93:15: fatal error: 'stdlib.h' file not found
#include_next <stdlib.h>
              ^~~~~~~~~~
1 error generated.
make: *** [ColorSpace.o] Error 1
ERROR: compilation failed for package ‘farver’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/farver’
Warning in install.packages :
  installation of package ‘farver’ had non-zero exit status
* installing *source* package ‘yaml’ ...
** package ‘yaml’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -DNDEBUG  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c api.c -o api.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from api.c:2:
In file included from ./yaml_private.h:6:
./yaml.h:18:10: fatal error: 'stdlib.h' file not found
#include <stdlib.h>
         ^~~~~~~~~~
1 error generated.
make: *** [api.o] Error 1
ERROR: compilation failed for package ‘yaml’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/yaml’
Warning in install.packages :
  installation of package ‘yaml’ had non-zero exit status
* installing *source* package ‘base64enc’ ...
** package ‘base64enc’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c base64.c -o base64.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from base64.c:86:
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:39:11: fatal error: 'stdio.h' file not found
# include <stdio.h>
          ^~~~~~~~~
1 error generated.
make: *** [base64.o] Error 1
ERROR: compilation failed for package ‘base64enc’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/base64enc’
Warning in install.packages :
  installation of package ‘base64enc’ had non-zero exit status
* installing *source* package ‘backports’ ...
** package ‘backports’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c dotsElt.c -o dotsElt.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from dotsElt.c:1:
/Library/Frameworks/R.framework/Resources/include/R.h:55:11: fatal error: 'stdlib.h' file not found
# include <stdlib.h> /* Not used by R itself, but widely assumed in packages */
          ^~~~~~~~~~
1 error generated.
make: *** [dotsElt.o] Error 1
ERROR: compilation failed for package ‘backports’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/backports’
Warning in install.packages :
  installation of package ‘backports’ had non-zero exit status
* installing *source* package ‘glue’ ...
** package ‘glue’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c glue.c -o glue.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from glue.c:1:
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:39:11: fatal error: 'stdio.h' file not found
# include <stdio.h>
          ^~~~~~~~~
1 error generated.
make: *** [glue.o] Error 1
ERROR: compilation failed for package ‘glue’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/glue’
Warning in install.packages :
  installation of package ‘glue’ had non-zero exit status
* installing *source* package ‘fansi’ ...
** package ‘fansi’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c assumptions.c -o assumptions.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from assumptions.c:21:
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:39:11: fatal error: 'stdio.h' file not found
# include <stdio.h>
          ^~~~~~~~~
1 error generated.
make: *** [assumptions.o] Error 1
ERROR: compilation failed for package ‘fansi’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/fansi’
Warning in install.packages :
  installation of package ‘fansi’ had non-zero exit status
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c api.cpp -o api.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from api.cpp:24:
In file included from ../inst/include/Rcpp.h:27:
In file included from ../inst/include/RcppCommon.h:29:
In file included from ../inst/include/Rcpp/r/headers.h:67:
In file included from ../inst/include/Rcpp/platform/compiler.h:100:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:304:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/math.h:300:15: fatal error: 'math.h' file not found
#include_next <math.h>

I haven't seen this behavior before, and can only think to confirm: There are two versions of R 3.6.3 available, one for Mac OS Catalina, but there's also a version of R 3.6.2 that seems to have worked without the extra requirement placed on Catalina for version 3.6.3:


I wonder whether installing the earlier R 3.6.2 version might help, but am not sure it will.

There seem to be a cluster of reports of errors involving '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' -- could this be related?

I'll have a go, thanks! Just about to finish work so will be back on in the UK morning time to let you know how I get on! Thanks so much for the help so far

Actually just had a go at installing the tidyverse in just R console rather than R studio and it worked just fine.

Could that help you understand what's wrong? Seems bizarre that

When you say 'R console', I'm not sure what you mean -- by opening R itself as an application on its own?

yes, here's a screenshot

Can you load the tidyverse in RStudio now? I'm pretty sure it uses the same package, so should work now since you were able to install it.

you are right, it does work.

I then tried to install a bespoke phylogenetics package, Claddis and it failed as it did previously with the tidyverse and ggplot2.

That is, until I tried to install it on the 'R console' itself, where it installed fine and would then work in RStudio. Don't know what it is, but the installation process is going wrong in RStudio somewhere