I'd like to run the homebrew version of R in Rstudio but it can't be opened. When I force to open Rstudio the error is:
dyld: could not load inserted library '/opt/homebrew/Cellar/r/4.0.4/lib/R/lib/libR.dylib' because no suitable image found. Did find:
/opt/homebrew/Cellar/r/4.0.4/lib/R/lib/libR.dylib: mach-o, but wrong architecture
/opt/homebrew/Cellar/r/4.0.4/lib/R/lib/libR.dylib: stat() failed with errno=1
I checked the architecture of the dylib, which is: Mach-O 64-bit dynamically linked shared library arm64. I think the architecture is correct and R can be run in the terminal.
This is a brew issue. I loved brew when I was on macOS, but never found it necessary to use it to install anything R related other than external libraries (which is a whole separate issue on macOS, because of its off-standard compile toolchain).
Caveat: Don't have an M1, only Big Sur
Recommendation: Use the canned version from RStudio
That's the problem; RStudio is not compatible with the arm64 version of R yet. We're working on it right now and hope to have a build out in a couple of weeks. In the meantime, you should have no trouble using the Intel (x86) version of R from CRAN with RStudio
Update: We now have daily builds available that should work with homebrew R on the M1. If you're willing to give them a shot, let us know how they work for you!