macos 确定可执行文件(或库)是 32 位还是 64 位

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1941825/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 06:37:51  来源:igfitidea点击:

Determine if an executable (or library) is 32 or 64 bit

macosbinaryosx-snow-leopard

提问by jideel

Is it possible to get information about any binary on OS X to determine if it's a 32 bit or 64 bit binary?

是否可以获取有关 OS X 上任何二进制文件的信息以确定它是 32 位还是 64 位二进制文​​件?

I played with the 'otool' command but can't find this kind of information.

我使用了“otool”命令,但找不到此类信息。

回答by Grant Lammi

Use the filecommand instead of otool. It will list all the architectures in the binary. On Intel Macs i386 is 32 bit and x86_64 is 64 bit.

使用file命令而不是otool. 它将列出二进制文件中的所有架构。在 Intel Mac 上,i386 是 32 位,x86_64 是 64 位。

回答by greg

From Nicholas in a comment, lipo -infoalso works. This is what you must use on static libraries, since fileonly displays "current ar archive random library."

来自尼古拉斯的评论,lipo -info也有效。这是您必须在静态库上使用的内容,因为file只显示“当前 ar 存档随机库”。