mac - How can I run a 32-bit app on 64-bit OSX 10.7.2?

16
2014-04
  • Kjuly

    I have an app that only exists a 32bit version. In order to use it, I used to press 2 & 3 together before booting the Mac, so it'll run in 32bit mode. However, some apps (64bit version that installed before) will always crash in this mode..

    I happened to see a solution that run 32bit app in 64bit system:

    arch -i386 theApp.app
    

    But I tried with arch: /Applications/theApp.app isn't executable error. I checked the file permission and it shown drwxrwxr-x, it should be executable, uh?
    EDIT: As @gd1 said, theApp.app is a folder(it's called bundle in OSX I think) and so it is not executable.

    But I still need a workaround:
    How can I run my 32-bit app in my 64-bit system correctly?


    EDIT: I can open the app with arch now with the command(thanks @GordonDavisson):

    arch -i386 /Applications/theApp.app/Contents/MacOS/theApp
    

    However, the app run with Components lost error, log shown below:

    Kjuly@MacBook-Pro:/Applications$ arch -i386 闪讯.app/Contents/MacOS/闪讯 
    2012-01-08 16:17:53.381 闪讯[472:1107] isActive: ioctl to kernel socket error 2 ,No such file or directory
    2012-01-08 16:17:53.436 闪讯[472:1107] The AppPath = /Applications/闪讯.app
    2012-01-08 16:17:53.437 闪讯[472:1107] The src path = /Applications/Èó™ËÆØ.app/xlpppoe.kext
    2012-01-08 16:17:58.892 闪讯[472:1107] Set Driver Ok...
    /tmp/xlpppoe.kext failed to load - (libkern/kext) requested architecture/executable not found; check the system/kernel logs for errors or try kextutil(8).
    

    BTW, the 闪讯.app(I hate it!! But I need it..) is used to connect to network in my university at China.


    EDIT:

    Kjuly@MacBook-Pro:~$ file /Applications/闪讯.app/Contents/MacOS/闪讯
    /Applications/闪讯.app/Contents/MacOS/闪讯: Mach-O executable i386
    

    and

    Kjuly@MacBook-Pro:~$ file /Applications/闪讯.app/xlpppoe.kext/Contents/MacOS/xlpppoe
    /Applications/闪讯.app/xlpppoe.kext/Contents/MacOS/xlpppoe: Mach-O object i386
    

    It seems it's 32-bit only & depends on the 32-bit kernel. Oh, I'm sooo sad. :(


    Here're some infos I got with the help from @GordonDavisson, maybe someone else need it.

    The DOC shows some methods to temporarily start up with the 32-bit kernel to use older kernel extensions for the third-party software or hardware.

    And it is about "Compatibility with the 64-bit kernel":

    Third-party software (such as a virtualization engine) or hardware (such as a PCIe card) that relies on a kernel extension which was compatible with Mac OS X Server v10.5 may not work on Macs that use the 64-bit kernel in Mac OS X v10.6. Contact the software or hardware vendor for an updated kernel extension that works with the 64-bit kernel in Mac OS X Server v10.6.

    As a workaround, you can temporarily start up with the 32-bit kernel to use older kernel extensions for your third-party software or hardware.

  • Answers
  • Gordon Davisson

    OS X doesn't have an overall 64/32 bit mode; it runs individual programs in whatever mode seems "best" when they're started. Holding 3 and 2 as the computer boots will make its kernel run in 32-bit mode, but this has nothing to do with what mode programs run in. OS X can happily run programs in 32-bit mode under a 64-bit kernel, or programs in 64-bit mode under a 32-bit kernel.

    If your program only includes 32-bit code, it will run in 32-bit mode without you having to do anything special. You can check this by running the file command on the executable (generally in AppName.app/Contents/MacOS/AppName. Here are a few examples:

    $ file /Applications/Chess.app/Contents/MacOS/Chess
    /Applications/Chess.app/Contents/MacOS/Chess: Mach-O universal binary with 2 architectures
    /Applications/Chess.app/Contents/MacOS/Chess (for architecture x86_64): Mach-O 64-bit executable x86_64
    /Applications/Chess.app/Contents/MacOS/Chess (for architecture i386):   Mach-O executable i386
    $ file /Applications/VLC.app/Contents/MacOS/VLC
    /Applications/VLC.app/Contents/MacOS/VLC: Mach-O universal binary with 2 architectures
    /Applications/VLC.app/Contents/MacOS/VLC (for architecture i386):   Mach-O executable i386
    /Applications/VLC.app/Contents/MacOS/VLC (for architecture ppc):    Mach-O executable ppc
    $ file /Applications/Adobe\ Reader\ 9/Adobe\ Reader.app/Contents/MacOS/AdobeReader 
    /Applications/Adobe Reader 9/Adobe Reader.app/Contents/MacOS/AdobeReader: Mach-O executable i386
    

    ... which tells me that Chess.app includes 32-bit and 64-bit Intel code ("i386" and "x86_64", respectively), VLC.app includes 32-bit Intel and 32-bit PowerPC ("ppc") code, and Adobe Reader only includes 32-bit Intel code.

    You can also get some of this information (although not in as explicit detail) from System Information's system report (in the Software -> Applications section).

    If an app has both 32- and 64-bit code, you can select which one to use in the Finder's Get Info window for the app (there'll be an "Open in 32-bit mode" checkbox), or by using the arch command on the executable (e.g. arch -i386 /Applications/theApp.app/Contents/MacOS/theApp). But you normally shouldn't need to do this, the OS does a good job of picking the best mode.

    (One instance where you would need to manually override the mode selection is for plugin or library compatibility. If you have a 32&64-bit app, but it needs to be able to load a 32-bit only plugin or library, you'll have to force the program to run in 32-bit mode.)

    If you have 64-bit programs that won't run right under a 32-bit kernel, they either have some sort of weird bug, or there's something even stranger going on. If you give the specific details, we might be able to figure out what's actually going wrong.

    EDIT: It looks like the app is 32-bit only, and installs a 32-bit only kernel extension (kext). While the 32-bit app portion can run under any kernel mode, the 32-bit kexts can only load into a 32-bit kernel (it's like a plugin for the kernel). You can run the kernel in 32-bit mode by holding 3 and 2 at startup, or permanently with the command sudo systemsetup -setkernelbootarchitecture i386 (see Apple's KB #HT3773).

    Note that it shouldn't be necessary to do anything special to open the app in 32-bit mode; since that's the only format included, it'll run in that mode no matter how it's launched (in particular, the arch command is not necessary).

    If you have any 64-bit apps that don't run properly under a 32-bit kernel, that's a separate issue and I'd recommend posting another question about that.


  • Related Question

    windows 7 - How to fake OS bit version check on some software
  • Viaceslav D.

    I have an application which has detection of my windows version. And it only goes through when it checks that its 32-bit version. As far as I know that my Windows 7 64-bit has compatibility to run 32-bit application, but how can I cheat/fake program to pass that check? :)


  • Related Answers
  • Roald van Doorn

    Why would a piece of software care if it's on 64-bits if it's designed for 32? It should work regardless if it's on 64 or 32 bits. Are you sure it's not the Windows version check that fails over being on Windows 7? I've had this for some driver-setups for my Asus motherboard, they claimed to be not compatible with Windows 7, but would work on Vista. Easily solved by setting the compatibility mode for the installer (right click on the program -> properties -> compatibility tab, and choose which windows version it should emulate).