Zulip Chat Archive
Stream: Is there code for X?
Topic: Check if a Mac is x64 or arm64?
Kaiyu Yang (Sep 12 2023 at 01:41):
Hi, I wonder if there is a way to check if the machine is a x64 (Intel) Mac or arm64 (Apple Silicon) Mac. I was only able to find functions like System.Platform.isOSX
but that does not solve the problem. Thanks!
Mario Carneiro (Sep 12 2023 at 01:49):
lake exe cache
is currently using this code to determine the architecture (on OSX/linux, on windows we just assume x86):
let mut arch ← (·.trim) <$> runCmd "uname" #["-m"] false
if arch = "arm64" then arch := "aarch64"
unless arch ∈ ["x86_64", "aarch64"] do
throw $ IO.userError s!"unsupported architecture {arch}"
Mario Carneiro (Sep 12 2023 at 01:49):
(runCmd
is just a wrapper around IO.Process.output
)
Kaiyu Yang (Sep 12 2023 at 01:52):
Thank you Mario!
Last updated: Dec 20 2023 at 11:08 UTC