I'm working on this code, and when I try to knit analyses.Rmd on one of my computers, I get an error specifically due to the attempt to load kableExtra:
Error: package or namespace load failed for ‘kableExtra’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Users/acristia/Library/Application Support/renv/cache/v5/R-4.1/x86_64-apple-darwin17.0/systemfonts/1.0.3/5be9fcf8ef6763e8cb13ab009e273a1d/systemfonts/libs/systemfonts.so': dlopen(/Users/acristia/Library/Application Support/renv/cache/v5/R-4.1/x86_64-apple-darwin17.0/systemfonts/1.0.3/5be9fcf8ef6763e8cb13ab009e273a1d/systemfonts/libs/systemfonts.so, 0x0006): Library not loaded: /usr/local/opt/freetype/lib/libfreetype.6.dylib Referenced from: /Users/acristia/Library/Application Support/renv/cache/v5/R-4.1/x86_64-apple-darwin17.0/systemfonts/1.0.3/5be9fcf8ef6763e8cb13ab009e273a1d/systemfonts/libs/systemfonts.so Reason: tried: '/usr/local/opt/freetype/lib/libfreetype.6.dylib' (no such file), '/Library/Frameworks/R.framework/Resources/lib/libfreetype.6.dylib' (no such file), '/Users/acristia/lib/libfreetype.6.dylib' (no such file), '/usr/local/lib/lib
I've checked that:
- I have the latest version of R, and Rstudio
- I have the latest version of freetype (also run brew doctor & fixed all warnings there)
Since brew was not installing libfreetype where kableExtra expected it, I did sudo mkdir -p /usr/local/opt/freetype/lib/
and sudo ln -s /opt/homebrew/lib/libfreetype.6.dylib /usr/local/opt/freetype/lib/libfreetype.6.dylib MacBook-Air:weirdChildes acristia$ ls /usr/local/opt/freetype/lib/libfreetype.6.dylib
With this, I changed the error from not loaded because it doesn't exist, to not loaded because of wrong architecture:
tried: '/usr/local/opt/freetype/lib/libfreetype.6.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')),
(I also saw a suggestion to do brew install freetype --universal
but that command is not recognized.
For context: I migrated my mac account to a new laptop, which is intel / monterey, and this probably means that some basic files are not right.
Or potentially, the error arises because makers of kableExtra need to take into account this new architecture. I did find two open issues mentioning libfreetype in the kableExtra github (one saying the problem was resolved with the latest R version, which is not my case).
For full information on my system, see renv-diagnostics.txt