Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

fix: use x86_64 arch for pre-built downloads on M1 devices #1876

Merged
merged 1 commit into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions npm/binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ const getPlatform = () => {
if (type === "Linux" && arch === "x64") {
return "x86_64-unknown-linux-musl";
}
if (type === "Darwin" && arch === "x64") {
if (type === "Darwin" && (arch === "x64" || arch == "arm64")) {
// for users of M1 / Apple Silicon devices, use an x86 binary automatically run by Rosetta 2.
return "x86_64-apple-darwin";
}
if (type === "Darwin" && arch === "arm64") {
return "aarch64-apple-darwin";
}

throw new Error(`Unsupported platform: ${type} ${arch}`);
};
Expand Down
4 changes: 1 addition & 3 deletions src/install/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,10 @@ fn prebuilt_url(tool_name: &str, owner: &str, version: &str) -> Option<String> {
} else {
let target = if target::LINUX && target::x86_64 {
"x86_64-unknown-linux-musl"
} else if target::MACOS && target::x86_64 {
} else if target::MACOS && (target::x86_64 || target::aarch64) {
"x86_64-apple-darwin"
} else if target::WINDOWS && target::x86_64 {
"x86_64-pc-windows-msvc"
} else if target::MACOS && target::aarch64 {
"aarch64-apple-darwin"
} else {
return None;
};
Expand Down