-
Notifications
You must be signed in to change notification settings - Fork 131
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
Apple silicon support #295
Comments
The M1 is in the same class of processors as the A-series chips used in iPhones and iPads so I don't think it should be a problem. They already said the M1 computers will be able to run all iPhone apps natively |
how about building react native projects on apple silicon machines? |
I don't have access to one of the new machines so I haven't tried but Xcode works on them so you'd think it'd work. At worst, you might have to run an older version of Xcode in emulated mode edit: I just saw in the Infinite Red slack channel that someone tried it and Xcode was not working for them. Sounds like a possible issue with Xcode itself though so maybe not an issue w/ RN |
I think it's quite too early to discuss this - let's wait until the laptops have been out for at least a few weeks before trying to figure out what is going to be needed to work. As @gwmccull points out correctly, it's most likely that first Android Studio and Xcode will have to properly work and then we can investigate if there are going to be React Native specific issues. |
Using Rosetta, I was able to install Homebrew and the necessary requirements to set up a working React Native environment according to the setup guide: https://reactnative.dev/docs/environment-setup. On my first attempt, I was receiving this error:
I fixed this error by opening Xcode > Preferences > Locations and selecting Xcode 12.2 from the Command Line Tools dropdown. After selecting this, I was able to go through the install and build process smoothly. Note: According to the activity monitor, Node and Watchman are using the Intel architecture (x86 through Rosetta) while the iOS simulator is using Apple's ARM architecture (and running very smoothly). Hope this helps! |
I wonder if whole Android stuff (build, emulator, etc) works properly as well. |
Thanks for sharing, @billycastelli. That's helpful. 👍 |
Seems like not everything is going well: |
There is a lot of workarounds involved with getting this to even remotely run, I attempted to build the RNTester app & was running into problems repeatedly. I will try to help, but it is unlikely I have the time. |
I've gotten that ffi error on Catalina as well. I had to |
Hey guys, thanks for opening up the discussion about this matter, I actually received an email from Apple notifying me about my app using Core Location and it might not work well since Mac does not have it. Any idea how to fix/adjust this? Thanks! |
Update here - I have been able to successfully use react native on my M1, additionally have had few problems with using the catalyst simulator, I think if you follow the steps with cocoapods you should generally be ok |
I can confirm that I'm also working with React Native on an M1 Mac and, to be honest, things are going way better than I thought they would. I installed CocoaPods using Not that it's directly related to React Native but I duplicated iTerm, called one iTerm x86 and set that to run with Rosetta. For Homebrew, managing all dependencies, and for the Metro bundler that's what's used and it's been just fine. It's all very fast, too, and I came from a 16" i9 MacBook Pro. |
Hey @darrylyoung do you have a quick benchmark for compilation time on iOS on your previous mac vs M1 ? |
I've been developing on Apple Silicon for a few days now and it's not bad. In fact the performance of the cli apps is the least of the concerns. What's different is that doing any pod work requires you to enter a Rosetta 2 shell with Of course the full arm64 suite is a ways away but if we could just do a build of a development IPA file with hot-reloads and open it up it directly in MacOS it would really close the loop on the Apple Silicon transition from a practical viewpoint. |
I've gotten in up and running without the need to use Rosetta at all. The only caveat is that I can't use Flipper (yet). My setup is available here: facebook/react-native#29984 (comment) @RETFU no benchmarks yet, but it's fast. |
Hi, @RETFU. Unfortunately not, no. I sold my 16" Pro when I got the M1 Air so didn't have chance to do side-by-side testing but after working on the 16" all year, I can say that the Air feels fast. Really fast. It obviously doesn't have the same 32 GB RAM as the 16" Pro but I haven't run into any issues yet doing daily development work. The best thing of all is how the Air clearly outperforms the 16" Pro but manages to do it completely silently and while barely warm to the touch, even when under the highest loads. It's impressive and I'm glad I'm able to continue working on my React Native project on this as there's no going back now. |
Regarding compilation times on the M1: I used to have a 2017 MacBook Pro with an i7 CPU and 16GB of RAM. The compilation times, using
(this includes both compiling via xcode and producing the js bundle) I'm running nodejs 15.3.0 compiled to arm64. With nodejs 14 and xcode running via rosetta2 the compilation time was 225 seconds, so still extremely good. Additionally, my main work PC was a Desktop i7 [email protected] with 32GB of RAM and an M.2 SSD (running Windows) and I benchmarked compiling the same Angular app in production mode on it vs the M1.
So, switched to the M1 full time. Even with just 8GB of RAM it still outperforms the Desktop i7 by a huge margin which I didn't expect. The SSD on the M1 is fast enough so that swapping is instant so the fact it has just 8GB of RAM isn't a huge deal breaker. I will still be upgrading to 16GB just because Chrome is super memory hungry and I noticed that having a ton of tabs open does degrade performance a tiny bit, so I need to be more mindful about that. |
I hope you'll find better way.. But this one worked for me: Environment: Issues and fixes:
|
Does using external monitors affect memory usage? I would be using 2 4k monitors with the 8gb ram and I am quite worried between webstorm, one simulator, couple of tabs in safari I might slow down the M1 Mac mini. |
I'm also using 2 4k monitors. I don't have anything to compare it with, but I don't notice any glaring issues. I usually have a simulator and couple of VSCode windows open, and probably 10-20 Chrome tabs open. Like mentioned previously, it seems like the biggest memory hog is the web browser, and I definitely need to manage my tabs better vs my previous i7 with 32GB of RAM. So I'll definitely be looking to upgrade to the 16GB model. However, besides the occasional 1-2 second mini stutters while it is swapping it's not a huge problem. I didn't run into any complete blockers because of the limited ram. Here's how the memory tab in Activity monitor looks like with:
A bit extreme on the swap usage, but hardly any performance degradation. |
I still have issues. After spending hours to make Cocoapods to work, now my build keeps failing with error code 65. I tried every solution suggested (Pod install, changing build settings, using Rosetta etc.) still no luck. Any help is appreciated from anyone who experienced the same and managed to solve this issue. |
I'm a little confused about whether people are saying they got things working natively or with Rosetta. Cause folks make it sound like they got things going arm64 style, but then. people are posting guides on how to just retreat to x86_64. So it's weird. Folks are also saying they can do just make a fresh React Native project and it works out of the box (minus Flipper). It seems like there's something I'm missing. |
I'm definitely using arm64 end to end with real complex apps. Based on my experience: I recommend compiling node 15 for arm ( If you use vscode and the terminals inside it, make sure to use the insiders version that is compiled for arm64, otherwise the terminals will run under Rosetta. |
Same for me. I'm running 100% silicon in my project. I'm using node v15 (which supports silicon). The only problem I had was installing pods, which failed because of a Flipper dependency. I removed it and got everything working. |
Found solution (workaround if you prefer), will publish guide ASAP. EDIT: My Ghost + Gatsby CI is broken, so I will have to fix tomorrow. |
Hey, I was able to make everything run natively without needing to install ffi or rosetta. The issue seems to be with the ruby version shipped default with MacOS, I read somewhere that for compatibility reasons it exposes arch as x86. The way I solved this was to brew install latest ruby version, do the exporting of path as brew asks to do and then voila my expo project was running on my device. On the emulator there is some weird error about expo-cli not being able to open expo app. |
Update: Flipper v74 should have a fix for arm64 devices Has anyone tried this? |
@hsavit1 yes I tried it and it works, also it fixed for me thank you for your help🙏❤️ |
@SohaibKtb did you not have any problems with OpenSSL? I posted a bug here facebook/flipper#1758 (comment) |
@SohaibKtb @hsavit1 can you guys please tell me how to fix the flipper issue. I did checked the fix for arm64 devices but I didn't get it. Thank you in advance. |
@manzars please check here the answers https://stackoverflow.com/a/66071245/11721286 If did not help, please let me know your issue, and will see if I can help you. |
After upgrading all the cli tools
I started a fresh project with RN 0.64.0-rc.3 which still had the reference to the old Flipper version so I upgraded that to v74 per @SohaibKtb post above, which brings me to a new error.
|
I also have this issue, happens with Swift projects (also on 0.63) |
@flavio0567 the error appears in Flipper-Folly, try specifying Flipper version, the instructions are in this answer: https://stackoverflow.com/a/66071245/11721286, if didn't help try specifying Flipper-Folly version this way:
|
@SohaibKtb I changed the Podfile with your suggestion, reinstalled pods and now one of the problems disappeared. Last de second one. Still trying to solve this 'atomic_notify_one' is unavailable. many thanks. |
@sunilkhuwaln running in Rosetta is not really a workaround, all benefits are lost |
I'm new to apple community, could you or someone else pls share what am I loosing while choosing Rosetta? |
Use the 3 commands that all issues on the topic describe, which is prefix with |
In my case for RN 0.64 (in native mode without rosetta) helped only creating empty swift file in project and removing LIBRARY_SEARCH_PATHS = ... in project.pbxproj |
Hey, Wanted to post this here because I finally found the solution for me after what seems like decades of searching. (You can completely remove the useFlipper function, or do the below) For Apple Silicon (M1 Chips): use_flipper!({ 'Flipper-Folly' => '2.3.0' }) Also, remove Pods/ & Podfile.lock, then run npx pod-install |
New M1 Macbook with latest updates and a new RN project with latest dependencies, these are the only two steps I've found to get RN to compile on the IOS simulator. Thanks so much for posting this, this is the only answer that works after many hours of searching. Before finding this I found that selecting this works but there's no debug menu. |
Same here, this is the only answer that allowed me to have a native version of a RN application running on the simulator. I may have to run some additional tests, but the app feels way faster already. |
Above worked for me except I had to disable Thanks @Nico-Guyon |
I am still getting issues installing
This is in a Rosetta terminal.app. |
Introduction
Will react native be supported by apple silicon?
Details
Discussion points
UPDATE
there may be some hiccups with getting cocoapods working, but overall seems to work well, as either a catalyst app or a iOS / android simulator app. Flipper does not seem to work, currently
UPDATE 2
Flipper version 75.1 mostly seems to fix M1 builds. see this comment https://stackoverflow.com/a/66071245/11721286
The text was updated successfully, but these errors were encountered: