Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.6: How much of Snow Leopard isn't yet 64-bit? System 10.6
Run the following command in Terminal to see exactly how many of OS X's extensions are 64-bit and how many are still 32-bit:
file /System/Library/Extensions/*.kext/Contents/MacOS/* |grep -i x86_64 |nl |tail -1 |cut -f1 -f3 && file /System/Library/Extensions/*.kext/Contents/MacOS/* |grep -v x86_64 |nl |tail -1 |cut -f1 -f3
[robg adds: This command will take a few seconds to run. On my MacBook Pro, there are 129 64-bit extensions and 325 32-bit extensions.]
    •    
  • Currently 1.80 / 5
  You rated: 4 / 5 (10 votes cast)
 
[9,539 views]  

10.6: How much of Snow Leopard isn't yet 64-bit? | 11 comments | Create New Account
Click here to return to the '10.6: How much of Snow Leopard isn't yet 64-bit?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: How much of Snow Leopard isn't yet 64-bit?
Authored by: mesa on Sep 18, '09 08:30:20AM

The following will run faster, it shows ppc kexts as well:

file /System/Library/Extensions/*.kext/Contents/MacOS/* | perl -nle 'print $1 if /\((.*)\)/' | sort | uniq -c

Of course all the kexts are universal binaries. On my system there are only 9 that aren't 64 bit, they seem to be for obsolete hardware. I guess that the ppc kexts are from leopard,.



[ Reply to This | # ]
10.6: How much of Snow Leopard isn't yet 64-bit?
Authored by: crazyj on Sep 18, '09 12:37:43PM
The counts don't match the command in the hint.
file /System/Library/Extensions/*.kext/Contents/MacOS/* |grep -i x86_64 |nl |tail -1 |cut -f1 -f3 && file /System/Library/Extensions/*.kext/Contents/MacOS/* |grep -v x86_64 |nl |tail -1 |cut -f1 -f3
127 Mach-O 64-bit kext bundle x86_64
320 Mach-O object i386


file /System/Library/Extensions/*.kext/Contents/MacOS/* | perl -nle 'print $1 if /\((.*)\)/' | sort | uniq -c
137 for architecture i386
40 for architecture ppc
127 for architecture x86_64

---
Sr. Editor, MacSlash
macslash.org

[ Reply to This | # ]

10.6: How much of Snow Leopard isn't yet 64-bit?
Authored by: mzso on Sep 18, '09 11:24:47PM

I concur. This one-liner seems to be the best (correct, short and most efficient) submitted so far.



[ Reply to This | # ]
10.6: How much of Snow Leopard isn't yet 64-bit?
Authored by: mzso on Sep 19, '09 12:06:05AM
I've spotted one small problem with this: you get only the various architecture counts and not the count of all extensions. Thus you can tell how many extensions have a 64-bit binary, but not how many extensions do not have (which was the point of the original post).

Here's a one-liner that should provide all the info:
file /System/Library/Extensions/*.kext/Contents/MacOS/* | awk 'BEGIN {total=0} /^[^(]*$/ {total++} /([^)]*)/ { start=index($0, "(")+1; $0=substr($0, start, index($0, ")")-start); kexts[$NF]++ } END { print "kexts total: " total; for (kext in kexts) print kext ": " kexts[kext] } '

It provides an output (on a 10.5.x) like this:
kexts total: 220
ppc: 109
i386: 112
ppc7400: 3
The number of extensions without 64 bit arch is: "kexts total" - "x86_64" (and of course the latter is zero in my case since I'm still running 10.5).

[ Reply to This | # ]
10.6: How much of Snow Leopard isn't yet 64-bit?
Authored by: mzso on Sep 19, '09 01:30:21AM
Unfortunately the previous one was still buggy. :-(
For non-universal binaries the file command outputs only a single line like this:
/System/Library/Extensions/AppleEFIRuntime.kext/Contents/MacOS/AppleEFIRuntime: Mach-O object i386
However, in case of a universal binary the "(for architecture ...)" section contains the real thing, since the "Mach-O object ..." section contains only the main architecture class.
Eg.
/System/Library/Extensions/TMSafetyNet.kext/Contents/MacOS/TMSafetyNet: Mach-O universal binary with 2 architectures
/System/Library/Extensions/TMSafetyNet.kext/Contents/MacOS/TMSafetyNet (for architecture i386): Mach-O object i386
/System/Library/Extensions/TMSafetyNet.kext/Contents/MacOS/TMSafetyNet (for architecture ppc7400): Mach-O object ppc
Taking this into account, here's a (hopefully now) correct one-liner:
file /System/Library/Extensions/*.kext/Contents/MacOS/* | awk '/Mach-O +[^ ]+ +[^ ]+$/ {if (match($0, "\\(for +architecture +")) { arch=substr($0, RSTART + RLENGTH); arch=substr(arch, 1, index(arch, ")")-1) } else { arch=$NF }; archs[arch]++; sub("( \\(for +architecture +[^ )]+\\))?:[^:]+Mach-O +[^ ]+ +[^ ]+$", ""); binaries[$0]=1 } END { total=0; for (bin in binaries) total++; print "total: " total; for (arch in archs) print arch ": " archs[arch] } '
It produces an output like this (on 10.5):
total: 220
ppc: 188
i386: 141
ppc7400: 3
And you can run it on /Applications/*.app/Contents/MacOS/* too and get a result like this:
total: 127
ppc: 6
i386: 123
For the latter I should mention that I've already cleaned up /Applications with Xslimmer and Monolingual.

[ Reply to This | # ]
10.6: How much of Snow Leopard isn't yet 64-bit?
Authored by: clith on Sep 18, '09 11:30:03AM
Just a quick comparison between 10.5.8 and 10.6.0: Running the line mentioned in the previous comment on 10.5.8:
109 for architecture i386
106 for architecture ppc
    3 for architecture ppc7400

For 10.6.0:

135 for architecture i386
  38 for architecture ppc
127 for architecture x86_64

Interesting.

[ Reply to This | # ]

10.6: How much of Snow Leopard isn't yet 64-bit?
Authored by: automandc on Sep 18, '09 01:21:52PM

You can also look at "Extensions" in the "Software" section of the System Profiler utility. (Select Apple Menu->About This Mac and then click "More Info"). One of the columns shows whether the .kext is 64-bit capable. Only those extensions that are not 64-bit will show up with a "No" in that column.

On my late 2007 MBP (MacBook Pro 3,1), there are 11 non-64 bit extensions (that is, extensions that are ONLY 32 bit). 9 of those are Apple SW. Compare with using the command in the tip, which seems to indicate 334 i386 arch. extensions. That must be double counting those that are both 32 and 64 bit.

I believe that once Apple provides a 64-bit clean firmware for the MBP 3,1, then I will be able to switch to the 64-bit Kernel (and need to replace/get rid of the Microsoft IntelliMouse driver).



[ Reply to This | # ]
10.6: How much of Snow Leopard isn't yet 64-bit?
Authored by: wfolta on Sep 18, '09 06:25:20PM

Very good post. I see 8 non-64-bit libraries with the System Profiler, and that's 3 CHUD (developer/debig) and 5 libraries with 6.0 in their names that also exist without the 6.0, so I think they are all compatibility:

3 CHUD
1 BSDKernel6.0
1 IOKit6.0
1 Libkern6.0
1 Mach6.0
1 System6.0

Pretty good results.



[ Reply to This | # ]
10.6: How much of Snow Leopard isn't yet 64-bit?
Authored by: dbingham on Sep 18, '09 06:34:15PM
Wow...this is entirely wrong. It counts each architecture in a universal binary as a different entry.

If you really want to know how many of your kext's are able to run x86_64, how many will only do i386 and how many are only ppc, try this:

oifs=$IFS&&IFS=$'\n'&&i=0&&x=0&&p=0&&for f in $(ls /System/Library/Extensions/*.kext/Contents/MacOS/*);do if [ $(file $f | grep -i x86_64 | wc -l) -gt 0 ];then x=$((x+1));elif [ $(file $f | grep -i i386 | wc -l) -gt 0 ];then i=$((i+1));else p=$((p+1));fi;done&&echo "$x x86_64"&&echo "$i i386"&&echo "$p ppc"&&IFS=$oifs
Which in more readable form is:

oifs=$IFS &&
IFS=$'\n' &&
i=0 &&
x=0 &&
p=0 &&
for f in $(ls /System/Library/Extensions/*.kext/Contents/MacOS/*); 
do 
  if [ $(file $f | grep -i x86_64 | wc -l) -gt 0 ]; 
  then 
    x=$((x+1)); 
  elif [ $(file $f | grep -i i386 | wc -l) -gt 0 ]; 
  then 
    i=$((i+1));
  else 
    p=$((p+1));
  fi;
done &&
echo "$x x86_64" &&
echo "$i i386" &&
echo "$p ppc" &&
IFS=$oifs
And the total of those three lines of output should equal:

ls /System/Library/Extensions/*.kext/Contents/MacOS/* | wc -l
-dbingham

[ Reply to This | # ]
10.6: How much of Snow Leopard isn't yet 64-bit?
Authored by: Dragon76 on Sep 20, '09 08:03:16AM
You have to remember that some kexts never need to be 64-bit.
Hardware specific to Core Duo Intel machines for example, do not need 64-bit extensions because Core Duo chips are only 32-bit.

[ Reply to This | # ]
10.6: How much of Snow Leopard isn't yet 64-bit?
Authored by: sipatel on Oct 02, '09 07:49:02AM

141 for architecture i386
44 for architecture ppc
128 for architecture x86_64



[ Reply to This | # ]