Identify Silicon or Intel Computer
By Randy Brown @Randy_Brown
Hi there!
How might you say "if this is an intel mac, do xyz" else if "this is a silicon mac, do 123"
Thanks in advance!
- SSreejesh Nair @Sreejesh_Nair
Here you go
var sType = sf.system.exec({ commandLine: `[[ "$(uname -m)" == "arm64" ]] && echo "Apple Silicon" || echo "Intel"`, }); if (sType.result === "Apple Silicon") { //Do Apple Silicon Stuff } else if (sType.result === "Intel") { //Do Intel stuff }
- In reply toRandy_Brown⬆:Kitch Membery @Kitch2024-12-17 19:40:36.427Z
Here's an alternate version constructed in a slightly different way...
const processorTypeLookup = { "arm64": "Apple Silicon", "x86_64": "Intel" } const processorArchitecture = sf.system.exec({ commandLine: `uname -m` }).result; const processorType = processorTypeLookup[processorArchitecture]; if (processorType === "Apple Silicon") { // Add Apple Silicon code here log("This mac running on Apple Silicon"); } else if (processorType === "Intel") { // Add Intel code here log("This mac running on Intel"); } // For Testing purposes log({ processorArchitecture, processorType });