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

Idea: if mac arm64 build becomes available, download this update on ARM macs #5672

Closed
bartoszhernas opened this issue Mar 3, 2021 · 12 comments · Fixed by #5901
Closed

Idea: if mac arm64 build becomes available, download this update on ARM macs #5672

bartoszhernas opened this issue Mar 3, 2021 · 12 comments · Fixed by #5901

Comments

@bartoszhernas
Copy link
Contributor

bartoszhernas commented Mar 3, 2021

macOS universal Electron build are twice as big (and more).
Because of that at FYM.fm we plan to provide separate builds for x64 and ARM64 architecture for macOS.

Currently this is problematic for our current users that are on x64 version of the app, running via Rosetta.
Even if we release the new ARM64 build, the users will be stuck on Intel version unless they download app from scratch from our website.

I checked the code and the fix seems easy, but I wanted to discuss first if this is something that electron-updater would like to do and if I should make a pull request for it.

Basically if I am on ARM Mac, using Intel version, I would like the updater to download ARM version for the update.

@mmaietta
Copy link
Collaborator

mmaietta commented Mar 4, 2021

Would using mac: { defaultArch: 'arm64' } in your config to get the right filename for it to default updating to arm64 if process.arch === arm64?

@bartoszhernas
Copy link
Contributor Author

Hi, sorry, I don't quite understand that.
Are you proposing that this is how it will work or asking if this is how I image it to work? Or that it works like you described?

Switching defaultArch would work for us as long as Intel macs are upgrading to Intel versions, and Intel on ARM users should upgrade to ARM version.

@mmaietta
Copy link
Collaborator

Actually, this functionality already exists without any electron-builder config changes.
#5524

// Allow arm64 macs to install universal or rosetta2(x64) - https://github.com/electron-userland/electron-builder/pull/5524
const isArm64 = (file: ResolvedUpdateFileInfo) => file.url.pathname.includes("arm64")
if (files.some(isArm64)) {
  files = files.filter(file => (process.arch === "arm64") === isArm64(file))
}

@bartoszhernas
Copy link
Contributor Author

Ah, you are right, the comment mislead me. Indeed, thank you for pointing it out.

@praneetrohida
Copy link

Actually, this functionality already exists without any electron-builder config changes.

if (files.some(isArm64)) {
  files = files.filter(file => (process.arch === "arm64") === isArm64(file))
}

@mmaietta I'm struggling to see how this will work since apps running in Rosetta will have the emulated process.arch value (x64), so they will get updated to the x64 version and not arm64. Correct me if I'm wrong.

Source

@mmaietta
Copy link
Collaborator

Hmm, great callout.

Hey @davej , you worked on #5524. Is your solution working for you? (Allow arm64 macs to update to x64 version if no arm64 version available)

@praneetrohida
Copy link

Can we reopen this issue?

@mmaietta mmaietta reopened this May 16, 2021
@mmaietta
Copy link
Collaborator

@praneetrohida would you be willing to tackle this?
It's simple to get a local dev env setup with your local project(s):
https://github.com/electron-userland/electron-builder/blob/master/CONTRIBUTING.md#to-setup-a-local-dev-environment

@praneetrohida
Copy link

@mmaietta I can open a PR but I don't have access to an arm64 mac machine to test it

@bartoszhernas
Copy link
Contributor Author

I will make a PR today (Tallinn time) and I have an ARM Mac :)

@davej
Copy link
Contributor

davej commented May 17, 2021

Hey @davej , you worked on #5524. Is your solution working for you? (Allow arm64 macs to update to x64 version if no arm64 version available)

@mmaietta @praneetrohida I only tested for updating Intel app on M1 to another Intel app on M1. I didn't think of testing the other scenario you mentioned. It makes 100% sense to me though. I suspect that you're correct that it will not allow an emulated Intel version to update to an M1 native app.

@bartoszhernas
Copy link
Contributor Author

Based on this: https://stackoverflow.com/questions/65346260/get-real-architecture-of-m1-mac-regardless-of-rosetta the current implementation won't work as suggested by @praneetrohida

I will post PR soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants