After updating to macOS 12.01 I am unable to generate any inline plots using ggplot in Rmd files that are stored in a Google Drive directory.
Any call to ggplot, e.g.
ggplot(iris, aes(x = Sepal.Length)) +
geom_bar(stat = "count")
Will fail with the error:
Error in dev.off() :
QuartzBitmap_Output - unable to open file '/Volumes/GoogleDrive/My Drive/.../.Rproj.user/shared/notebooks/-analysis/1/BB6A8C74064F89F4/cr5qmxwe04yxu_t/_rs_chunk_plot_001.png'
Executing this code in the console works fine, and I can knit the Rmd without errors. Changing the graphics backend to Cairo also fixes this, so it seems likely to be an issue with Quartz.
Moving the project file to a local directory also resolves this, but previous to macOS 12.01, R project integration with Google Drive would not cause these issues.
Xcode, XQuartz, R, and RStudio are all up to date.