Architecture mixup

Ryan Schmidt ryandesign at macports.org
Thu May 17 13:34:19 PDT 2012


On May 17, 2012, at 15:27, Jeremy Lavergne wrote:

>> That's kind of what I was trying to say (very badly as it turned out).
>> 
>> I can't find the OS X equivalent of:
>> 
>> `egrep '(vm|svm)' --color=always /proc/cpuinfo`
>> 
>> which although it is strictly speaking the way of finding out if your
>> box is capable of hardware virtualization, is also useful as a sure fire
>> way of knowing if your kernel is 64-bit.
> 
> Is sysctl viable for that?
> hw.optional.x86_64: 1

I was not aware of that sysctl variable but it appears to be accurate, though only for Intel machines of course. The one MacPorts base itself uses (to determine the default build_arch) is hw.cpu64bit_capable which should work on PowerPC machines as well. Note that this works on Leopard and up only.


For your amusement, here are a few values from a few different systems I have access to:


MacBookPro3,1, a 64-bit machine with the 32-bit kernel:

$ uname -p
i386
$ uname -m
i386
$ sysctl hw.cpu64bit_capable
hw.cpu64bit_capable: 1
$ sysctl hw.optional.x86_64
hw.optional.x86_64: 1
$ 



Xserve3,1, a 64-bit machine with the 64-bit kernel:

$ uname -p
i386
$ uname -m
x86_64
$ sysctl hw.cpu64bit_capable
hw.cpu64bit_capable: 1
$ sysctl hw.optional.x86_64
hw.optional.x86_64: 1
$ 



The first Apple TV, a 32-bit machine with the 32-bit kernel:

$ uname -p
i386
$ uname -m
i386
$ sysctl hw.cpu64bit_capable                          
hw.cpu64bit_capable: 0
$ sysctl hw.optional.x86_64
hw.optional.x86_64: 0
$ 






More information about the macports-users mailing list