Home > front end >  How do I know macOS has intel chip (or) m1 chip from command line?
How do I know macOS has intel chip (or) m1 chip from command line?

Time:01-29

I need to run an executable based on the processor it has. If it has intel based chip then I will run one kind of executable and for an arm-based m1 chip, I will run another executable intended for the same operation.

In order to do the above task, in my code, I need to get the information on which processor was installed in the mac PC from the command line? Could anyone suggest how to get the processor information from the command line for macOS?

It would be great if you answer for other operating systems such as Linux and Windows?

CodePudding user response:

Try typing

arch

Into the console, it prints out my system architecture on my machine.

CodePudding user response:

type

system_profiler SPHardwareDataType | less

it shows:

Hardware Overview:

  Model Name: MacBook Pro
  Model Identifier: MacBookPro15,2
  Processor Name: Quad-Core Intel Core i5
  Processor Speed: 2,4 GHz
  Number of Processors: 1
  Total Number of Cores: 4
  L2 Cache (per Core): 256 KB
  L3 Cache: 6 MB
  Hyper-Threading Technology: Enabled
  Memory: 8 GB
  ...

CodePudding user response:

type on cmd prompt 'sysctl -n machdep.cpu.brand_string'

its shows

% sysctl -n machdep.cpu.brand_string Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz

  •  Tags:  
  • Related