How to check if a library is 32bit/64bit built on Mac OS X?

prosseek picture prosseek · Jul 8, 2010 · Viewed 12.3k times · Source

I'm having some trouble in using PyQt/SIP. I guess the SIP is compiled into 64bit, but Python has some problem with finding it.

  File "qtdemo.py", line 46, in 
    import sip
ImportError: dlopen(/Library/Python/2.6/site-packages/sip.so, 2): no suitable image found.  Did find:
        /Library/Python/2.6/site-packages/sip.so: mach-o, but wrong architecture
  • How do I know if a library (so/dylib) is 32bit or 64bit?
  • How do I know if my Python is 32bit or 64bit?

Answer

Nikolai Ruhe picture Nikolai Ruhe · Jul 8, 2010

The file tool can be used to identify executables.

Example:

> file /Applications/TextEdit.app/Contents/MacOS/TextEdit 
/Applications/TextEdit.app/Contents/MacOS/TextEdit: Mach-O universal binary with 2 architectures
/Applications/TextEdit.app/Contents/MacOS/TextEdit (for architecture x86_64):   Mach-O 64-bit executable x86_64
/Applications/TextEdit.app/Contents/MacOS/TextEdit (for architecture i386): Mach-O executable i386