I’m getting the following error on a Github Action R CMD check for Mac OS. Other OSs give no errors. Strangely, my package does not use tcltk at all. I can’t figure out how to fix the package to avoid the problem, and CRAN won’t let me upload with this problem.

── Install failure ─────────────────────────────────────────────────────────────

* installing *source* package ‘weird’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
tcltk DLL is linked to '/opt/X11/lib/libX11.6.dylib'
Error: Error: .onLoad failed in loadNamespace() for 'tcltk', details:
  call: fun(libname, pkgname)
  error: X11 library is missing: install XQuartz from www.xquartz.org
Execution halted
ERROR: lazy loading failed for package ‘weird’
* removing ‘/Users/runner/work/weird-package/weird-package/check/weird.Rcheck/weird’

1 error ✖ | 0 warnings ✔ | 0 notes ✔
Error: Process completed with exit code 1.

I know I can fix the problem on Github Action by adding

- name: Install XQuartz on macOS
        if: runner.os == 'macOS'
        run: brew install xquartz --cask

to the yaml, but that only avoids the problem on Github. The problem is still there when I submit to CRAN.