Mac: Failing to install any packages (i.e. Rcpp) after downloading RStudio: error: installation of package 'Rcpp' had non-zero exit status

Hi, and welcome!

Please see the FAQ: What's a reproducible example (`reprex`) and how do I create one? Using a reprex, complete with representative data will attract quicker and more answers. Only for future reference.

The error message

lang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]

shows that you don't have XCode's command line utility installed.

If you haven't already, download the free XCode app from the app store. Then from the command line

xcode-select --install

Be aware that MAC OS uses a non-standard compiler and programs to be installed by source sometimes throw the zero exit status error. If that happens, choose No to the Do you want to install from source and get the latest binary edition prepared by Saint Simon Urbanek of the Core R Team, who carries the brain damage burden of tweaking the code for us.