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

fix: allow and pick darwin x86_64 binary on apple silicon macs #564

Merged
merged 1 commit into from
Nov 27, 2020

Conversation

sod
Copy link
Contributor

@sod sod commented Nov 26, 2020

When you try to npm install esbuild on a m1 mac, you see this error:

Allow and pick darwin x86_64 binary on apple silicon macs. It'll run just fine through rosetta 2 translation, at least throwing the 8.4MB typescript.js file against it works without complaining:

Native darwin arm64 seems not to be supported yet by golang. It's planned for go v1.16 (from golang/go#42756)

Copy link
Owner

@evanw evanw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh huh, that's pretty neat. Definitely a good fix in the meantime. Thanks for trying it out and for putting this together. I'll have to trust you that it works since I don't have access to a M1 myself.

@evanw evanw merged commit c43d4a8 into evanw:master Nov 27, 2020
evanw added a commit that referenced this pull request Nov 27, 2020
@evanw evanw mentioned this pull request Nov 27, 2020
@evanw
Copy link
Owner

evanw commented Nov 29, 2020

This has been released. Please let me know if this works for you or not.

@sod
Copy link
Contributor Author

sod commented Nov 29, 2020

Yes, can confirm. npm install esbuild works. And vite via npm i -g vite; npm init vite-app vite-test; cd vite-test; npm run build works as well. Thx for publishing it 👍

@RoXuS
Copy link

RoXuS commented Dec 4, 2020

@sod I get
image
Do you do something else?

@sod
Copy link
Contributor Author

sod commented Dec 4, 2020

Do you have rosetta 2 installed?

@RoXuS
Copy link

RoXuS commented Dec 4, 2020

nop, oh I have to you use rosetta2 on this ?

@sod
Copy link
Contributor Author

sod commented Dec 4, 2020

x86 binaries don't run natively on m1. They have to be transpiled by rosetta 2 to function.

Native darwin arm64 binary for esbuild is not possible at this time, as golang has no support for it yet.

@sod
Copy link
Contributor Author

sod commented Dec 4, 2020

And you don't have to actively "use rosetta 2", it just has to be installed and then just transparently compiles x86 binaries to arm64 when it encounters one.

@RoXuS
Copy link

RoXuS commented Dec 4, 2020

Oh thx! Work as expected!

@evanw
Copy link
Owner

evanw commented Dec 4, 2020

Heads up that this might not be completely smooth sailing. The Hugo project (another Go-based web development tool) is getting reports of emulation issues with running Go-based code with Rosetta 2: gohugoio/hugo#7968. I'm not yet aware of any reports like this from esbuild users but I wouldn't be surprised if it comes up.

evanw added a commit that referenced this pull request Dec 5, 2020
@RoXuS
Copy link

RoXuS commented Dec 7, 2020

@sod, it is ok if you install go from head if you don't want to wait Go 1.16.
With this GIST -> https://gist.github.com/felixbuenemann/d08875fc3e1a69fe8d6eaa724829c950

Working great!

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 this pull request may close these issues.

3 participants