Rstudio can't open home-brew installed R on Apple M1

Error Information:

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.

System Information:

  • RStudio Edition: Desktop
  • RStudio Version: 1.4.1103
  • OS Version: Big Sur 11.2.1 Apple M1
  • R Version: 4.0.4

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

See this issue for details: https://github.com/rstudio/rstudio/issues/8652

2 Likes

Got it. Thank you so much!

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!

This topic was automatically closed 7 days after the last reply. 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.