No internet connection
  1. Home
  2. How to

Identify Silicon or Intel Computer

By Randy Brown @Randy_Brown
    2024-12-17 08:29:43.799Z

    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!

    • 2 replies
    1. S
      Sreejesh Nair @Sreejesh_Nair
        2024-12-17 09:43:59.685Z

        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
        }
        
        1. 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 });