Cannot compile R packages with c++ code after updating to macOS Catalina

Please use either:

Or go through the steps by hand:

The main change required for this version of macOS is the need to set flags to the header locations as no SDK kits are available to reinstall into the expected directories for R.

You likely need to reinstall command line tools -- Apple often uninstalls them after OS updates. Try running:

xcode-select --install

in the terminal. (Note that, even if you're using the R-provided LLVM toolchain, it will still require access to the default system headers, and those are installed as part of the command line tools toolchain)

EDIT: @coatless is spot on. In particular, from, you need to set up your ~/.R/Makevars to point to the system headers:

mkdir -p ~/.R

# Fill with appropriate flag statements
cat <<- EOF > ~/.R/Makevars
# clang: start
CFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXXFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
# clang: end

Note that R 3.6.1 patched does this by default -- e.g. I have in my $(R RHOME)/etc/Makeconf:

CPPFLAGS = -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include