Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add native support for Apple's ARM chips (arm64, M1) to RStudio for macOS #8652

Closed
jmcphers opened this issue Dec 21, 2020 · 31 comments
Closed

Comments

@jmcphers
Copy link
Member

jmcphers commented Dec 21, 2020

R and RStudio work today on the M1 chip, albeit with compromised performance, via Rosetta2, an emulation layer. This issue tracks the work needed to add native support for Apple's new ARM-based silicon to RStudio.

  • We should do this as a universal binary, supporting x86_64 and arm64 without requiring a separate download. Thankfully it is possible to build arm64 binaries on x86_64 hardware. The only downside of this approach is that it will make the binary enormous (as we will ultimately ship x86_64 and arm64 versions of Chromium).
  • Our build infrastructure will need to be updated to the latest version of Xcode to get support for cross-compiling to arm64.
  • Because we load R as a library, we need to wait for R itself to be ported to Apple silicon before RStudio can be fully ported. This is in the works, but currently held up due to dependencies on tooling further upstream. See Will R Work on Apple Silicon? from the R Core team. (Update: It works now. https://mac.r-project.org/)
  • On the front end, we depend on QtWebEngine, which also does not build for M1 (see QT-85279). This should not be an issue since we hope to move to Electron (EPIC: Electron #7389), which supports M1 as of the 11.0 release.
  • Several binaries we bundle will have to continue to run under Rosetta2 since they don't have M1 ports available and won't for the foreseeable future. See e.g., Please build a universal binary for macOS jgm/pandoc#6960

Other useful links

@jmcphers jmcphers added this to the v1.5 milestone Dec 21, 2020
@ronblum ronblum added tech debt internal tech debt with no direct benefit to customer. macos labels Dec 21, 2020
@elbamos
Copy link

elbamos commented Jan 16, 2021

Now that there's a stable R 4.1-devel binary for Apple Silicon, is there anything people can do to be helpful in moving this issue forward?

(If I might suggest, more important than making a universal binary, is making an Apple Silicon binary that is capable of loading either an x86_64 or osx_arm64 R library.

I don't think people would be bothered by the effort of choosing the frontend appropriate to their architecture when they download.

A greater concern is whether I will still be able to use RStudio with both the most current R, and older R versions that are x86 that I used to build older code.)

@mikebessuille mikebessuille removed the tech debt internal tech debt with no direct benefit to customer. label Jan 27, 2021
@mattwaltbriggs
Copy link

RStudio depends on gdb. Without an M1 port of gdb, compilation is a no-go. (Correct me if I'm wrong.)

@elbamos
Copy link

elbamos commented Feb 11, 2021

RStudio could help tide us over if you made available linux aarch64 debian packages that could be included in a docker...

I've built this: https://github.com/elbamos/rstudio-m1 but an aarch64 debian package would make for a much better build.

@jmcphers
Copy link
Member Author

@elbamos We are tracking the Linux support for this architecture in #8809.

@mikebessuille
Copy link
Contributor

Using this issue to track native M1 support for the whole RStudio IDE, not just running RSessions. Sessions with native M1 version of R will be supported in 1.4-Juliet-Rose.

@gtamayo59
Copy link

I am beginning to think that my purchase of M1 Mac mini was a mistake. I can not run anything! R and Rstudio and all other free softwares that run over R.... I am not a programmer, I am just an user and love Mac for being user-friendly.
My big question: is there any serious development towards writing and R and Rstudio package ready to be installed in M1 Macs? Or even, ARM64 Windows?

@kevinushey
Copy link
Contributor

The daily builds of RStudio support arm64 builds of R: https://dailies.rstudio.com

@mshamash
Copy link

mshamash commented Apr 24, 2021

@gtamayo59 There is also a stable version of R 4.0.3 available via miniforge (or just conda-forge channel) which is native for M1/arm64 macs and will work with daily builds of RStudio linked above:

> version
               _                           
platform       aarch64-apple-darwin20.0.0  
arch           aarch64                     
os             darwin20.0.0                
system         aarch64, darwin20.0.0       
status                                     
major          4                           
minor          0.3                         
year           2020                        
month          10                          
day            10                          
svn rev        79318                       
language       R                           
version.string R version 4.0.3 (2020-10-10)
nickname       Bunny-Wunnies Freak Out  

EDIT: you can actually install via homebrew too, brew install r, to get a newer native version:

> version
               _                           
platform       aarch64-apple-darwin20.3.0  
arch           aarch64                     
os             darwin20.3.0                
system         aarch64, darwin20.3.0       
status                                     
major          4                           
minor          0.5                         
year           2021                        
month          03                          
day            31                          
svn rev        80133                       
language       R                           
version.string R version 4.0.5 (2021-03-31)
nickname       Shake and Throw

@gtamayo59
Copy link

@gtamayo59 There is also a stable version of R 4.0.3 available via miniforge (or just conda-forge channel) which is native for M1/arm64 macs and will work with daily builds of RStudio linked above

> version
               _                           
platform       aarch64-apple-darwin20.0.0  
arch           aarch64                     
os             darwin20.0.0                
system         aarch64, darwin20.0.0       
status                                     
major          4                           
minor          0.3                         
year           2020                        
month          10                          
day            10                          
svn rev        79318                       
language       R                           
version.string R version 4.0.3 (2020-10-10)
nickname       Bunny-Wunnies Freak Out  

For a non-verse programmer nor unix user, it seems complicated. Any recipe direction will be great! A wiki document (kind of "for dummies" will be appreciated! I tried following your directions (OK, I got it, I need to install first R. But this (https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#g_t_0060Apple-Silicon_0027) it is impossible for me, to deduct what I need to do first. Download the Xquartz, downloaded the Darwin.20-arm64.tar, which in turn downloaded R and from there, I went nowhere.

@mshamash
Copy link

mshamash commented Apr 24, 2021

@gtamayo59 you should be able to download the R 4.2.0 beta installer (R-devel 4.2.0 Under development, r80216) from this link: https://mac.r-project.org/#nightly
Then just run through the installer and you should have native arm64 R installed - without the hassle of compilation!

Keep in mind though it's an unstable build...I believe once R 4.1.0 is released it will include aarch64 binaries as well, but for some reason the R 4.1.0 nightlies don't include it, so maybe it got pushed to 4.2.0

> version
               _                                                 
platform       aarch64-apple-darwin20.0                          
arch           aarch64                                           
os             darwin20.0                                        
system         aarch64, darwin20.0                               
status         Under development (unstable)                      
major          4                                                 
minor          2.0                                               
year           2021                                              
month          04                                                
day            23                                                
svn rev        80216                                             
language       R                                                 
version.string R Under development (unstable) (2021-04-23 r80216)
nickname       Unsuffered Consequences  

@mshamash
Copy link

mshamash commented Apr 24, 2021

@gtamayo59 if you want to use latest stable version of R (4.0.5, 2021-03-31, Shake and Throw) here is a small guide which is basically what I ended up doing:

  • Install homebrew by running the one command they list on their website (https://brew.sh/)
  • Run the command brew install r from your Mac's Terminal
  • EDIT: RStudio daily build 1.4.1689 and newer includes a fix for this step, so you can skip it.
    Run the command sudo mkdir /usr/local/bin && sudo ln -s /opt/ho mebrew/bin/R /usr/local/bin/R [this is a workaround since RStudio doesn't look in the homebrew for ARM folder by default, so we make a shortcut]
  • Open RStudio (latest daily build from here https://dailies.rstudio.com/) and run the version command in the R command line to make sure the arch is aarch64, and you are running version 4.0.5

@gtamayo59
Copy link

@mshamash, great! One quick question: do I have to make a daily re-build of RStudio?

@mshamash
Copy link

mshamash commented Apr 24, 2021

@gtamayo59 You shouldn't have to per se, but there will be new daily builds available at the rstudio dailies link, every day. These kinds of builds are usually bleeding-edge so may have some bugs, but I think the next version of RStudio (v1.4 juliet rose) which should be released end-April/early-May will have support for ARM RSessions by default, so once that's out you can just switch to that version of RStudio instead of daily builds. Hope that was clear enough! And hope my instructions worked out!

@gtamayo59
Copy link

@mshamash, checking on the R.version, I see the report:
_
platform x86_64-apple-darwin17.0
arch x86_64
os darwin17.0
system x86_64, darwin17.0
status
major 4
minor 0.5
year 2021
month 03
day 31
svn rev 80133
language R
version.string R version 4.0.5 (2021-03-31)
nickname Shake and Throw

It seems that I download a wrong version of R or RStudio, as the platform was not recognized

@mshamash
Copy link

@gtamayo59 Looks like you have the Intel version of R installed, maybe in addition to the ARM version, but RStudio is only choosing one to work with. It should still work fine with all your packages though (in theory), since macOS' Rosetta translation layer is really great, but if you want to continue setting up the native ARM version only, then feel free to reach out to me by email (on my GitHub profile I have my personal webpage link, email at the bottom) - just so we don't keep alerting everyone in this thread.

@astamm
Copy link

astamm commented Sep 8, 2021

Hi all,
I was wondering if there was any progress and if you were planning on releasing a native ARM version of RStudio anytime soon. Thanks for all the hard work you put in RStudio. I've been using it for more than a decade and really enjoy what it has become!

@mikebessuille
Copy link
Contributor

@astamm , sessions can now be run natively on an M1 processor as part of our build, as of Juliet Rose which was released in May 2021. Give that the IDE itself works well using apple's translation layer, we don't expect to release the rest of the IDE in native mode for awhile, late 2022 at the earliest.

@astamm
Copy link

astamm commented Sep 9, 2021

Thanks @mikebessuille . I was indeed talking about the IDE itself. I was trying to avoid as much as possible having to resort to Rosetta2 because I feel like it's a pity having M1 processors and not fully taking advantage of them, but, given the timeline you are announcing, I might fall back to it for the time being. Thanks anyway for the quick follow-up.

@mikebessuille
Copy link
Contributor

The vast majority of performance gain you will see from an M1 chip is when running R code, and the R session is already native on the M1, so additional performance improvements by making the IDE itself native will be relatively small in comparison.

@gtritchie
Copy link
Member

We will use this issue to track confirming that all components other than the IDE itself are M1 native.

For the IDE itself (the desktop app and the rsession), that's tracked in: #10116.

@marko-asplund
Copy link

Any progress on this?

@kevinushey
Copy link
Contributor

The latest releases of RStudio support arm64 builds of R. Work is ongoing to produce arm64-native builds of RStudio.

@kevinushey
Copy link
Contributor

This has technically been implemented, but I guess we'll want to wait until we start publishing preview builds of RStudio with Electron until we officially consider it closed?

@marko-asplund
Copy link

From a user POV, that would seem like a logical approach 👍
Looking forward to trying out the arm64 builds 🤩

@mikebessuille mikebessuille added test and removed backlog labels Mar 2, 2022
@mikebessuille
Copy link
Contributor

@kevinushey I think this should be in Test, since the work is done to create the build.

@gtritchie
Copy link
Member

Closing, we've been producing universal Mac builds of RStudio Electron for months now. They aren't prominently linked yet, but people have been finding them.

@elbamos
Copy link

elbamos commented Mar 29, 2022

Can you provide some advice for finding them? @gtritchie

@gtritchie
Copy link
Member

Can you provide some advice for finding them?

They are still very much a work in progress. Not all features are implemented, and very little formal testing has yet been done.

With those caveats and dire warnings:

https://dailies.rstudio.com/rstudio/spotted-wakerobin/electron/macos/
https://dailies.rstudio.com/rstudio/spotted-wakerobin/electron/windows/
https://dailies.rstudio.com/rstudio/spotted-wakerobin/electron/bionic/
https://dailies.rstudio.com/rstudio/spotted-wakerobin/electron/rhel8/
https://dailies.rstudio.com/rstudio/spotted-wakerobin/electron/centos7/
https://dailies.rstudio.com/rstudio/spotted-wakerobin/electron/opensuse15/

@elbamos
Copy link

elbamos commented Mar 30, 2022

Runs great so far! New icon looks yucky like a Microsoft icon.

@gtritchie
Copy link
Member

The new icon isn't specific to Electron. See #8395 for more on that saga.

br3ndonland added a commit to br3ndonland/dotfiles that referenced this issue May 14, 2022
RStudio has apparently been producing universal builds "for months now",
though it's not mentioned in their release notes.
rstudio/rstudio#8652 (comment)
https://www.rstudio.com/products/rstudio/download/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests