Rcpp compilation breaks in R 4.1.0 running on Big Sur 11.4


I've recently updated to R 4.1.0 as well as Xcode 12.5.1 after installing macOS Big Sur 11.4. However, I am unable to run R packages requiring compiled code via Rcpp.

I have both Clang 12.0.5 build 1205 and Command Line Tools installed.

However, in RStudio, I am continually prompted to install additional build tools and I can't seem to figure out why. I can bypass this with options(buildtools.check = function(action) TRUE), but this doesn't resolve the problem.

When I attempt to build my package I get a number of errors which I found are due to Rcpp not being able to be compiled properly, similar to those found here

Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.

When I call the above link and click either Yes or No, I receive the exact same error message again.

I've also followed this link for assistance

but the issue still persists.

Here is my brew config. Note: I did not install R via Homebrew, so no need to run `brew install -- cask r'.

ORIGIN: https://github.com/Homebrew/brew
HEAD: 09f7bc27a99469cf947431df4754737dfbadb31d
Last commit: 3 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: b1c76d0f6e481ae009775f96f89c6cd1c635822d
Core tap last commit: 6 days ago
Core tap branch: master
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.rMYzzALIlM/org.macosforge.xquartz:0
Homebrew Ruby: 2.6.3 =>     /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: quad-core 64-bit broadwell
Clang: 12.0.5 build 1205
Git: 2.10.1 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.4-x86_64

Disclaimer: I posted an issue (#118) on this on GitHub pkgbuild repo. Jim Hester, a fellow macOS user and RStudio aficionado has been helpful, but we've still not been able to arrive at a solution.

So, I thought I'd cast a wider net by asking on this forum.

Any help is warmly welcomed and greatly appreciated


Hi. Were you able to find a solution to your problem?

I seem to be having the same issue. I upgraded to Big Sur v. 11.5.1 and as soon as I did I started getting the same "could not find tools necessary to compile a package" error message. I've tried reinstalling Xcode and Command Line Tools, but haven't been able to really diagnose the problem or figure out how to fix it.


Same here... no solution. I'm still stuck!

I've tried everything I can think of and managed to find via Googling.

This said, I've noticed my Makevars file in the .R folder still says it using Clang4 even though I have Clang12 installed. I am unable to edit this file because apparently I don't have permission to do so.

I have done everything instructed on

R Compiler Tools for Rcpp on macOS | The Coatless Professor

but I still get the weird pop-up window asking me to install additional tools.

@kbrevoort I fixed the issue!

Turns out R was pointing to an old clang version in my Makevars.

I just deleted it using

sudo rm ~/.R/Makevars

I hope this helps you out!

This topic was automatically closed after 45 days. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.