简体   繁体   English

我如何从命令行知道 macOS 有英特尔芯片(或)m1 芯片?

[英]How do I know macOS has intel chip (or) m1 chip from command line?

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.如果它具有基于英特尔的芯片,那么我将运行一种可执行文件,对于基于 arm 的 m1 芯片,我将运行另一个用于相同操作的可执行文件。

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?为了完成上述任务,在我的代码中,我需要从命令行获取有关 mac PC 中安装了哪个处理器的信息? Could anyone suggest how to get the processor information from the command line for macOS?谁能建议如何从 macOS 的命令行获取处理器信息?

It would be great if you answer for other operating systems such as Linux and Windows?如果您回答其他操作系统(例如 Linux 和 Windows)会很棒吗?

Try typing尝试输入

arch

Into the console, it prints out my system architecture on my machine.在控制台中,它会在我的机器上打印出我的系统架构。

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
  ...

type on cmd prompt 'sysctl -n machdep.cpu.brand_string'在 cmd 提示 'sysctl -n machdep.cpu.brand_string' 上键入

its shows它的节目

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM