Friday, May 18, 2018

Where are my 32bit apps?

     Recent versions of macOS High Sierra are warning users that their applications are "not optimized" for their Mac. This message is caused when 32bit applications are built and there are tons of articles explaining this. For more information, you can search for them.

    Above is an example of the warning for the app "DjView", which is compiled as 32bit and opened on High Sierra 10.13.4. This message is simple to dismiss, but annoying for users in lab environments where their "acceptance" of the less-than-optimized versions are not stored from session to session. Apple has provided the ability to prevent this message by using the following command within the recovery environment (MacObserver Post):
sudo nvram boot-args="-no32exec"
    This preference is helpful, but less so as it's restricted to an environment that requires some admin interaction with the actual hardware. I've also seen suggestions that the following defaults command can be run as root to disable the warnings:
sudo defaults write -g CSUIDisable32BitWarning -boolean true
    I've not had the same luck with the defaults command that others have so your mileage may vary. The best resolution to this message is likely going to be replacing the 32bit apps with 64bit versions. This is harder than it sounds, as some applications used in our lab environments have not been updated in a few years or more. Developers are likely not going to be able to quickly "patch" these apps with a new 64bit build, so finding replacements or ignoring the message may be the most common resolution.

    So, where are all your 32bit apps? Well, most of the articles I've found direct you to look at the System Information.app, which has a nice list of Applications and a Yes/No column for 64-Bit (9TO5Mac Source). I prefer a less GUI method and have found two additional methods for locating apps.

    The first method uses mdfind and the Spotlight database to locate files that have the 'i386' architecture and excludes anything that is already 64 bit. Excluding 64-bit apps explicitly is important because some binaries are built with both 32 and 64 bit. Update: Testing an app that's universal seems to still prompt, for example SoundHack.app displayed the warning. These "universal binaries" shouldn't interfere with the transition to 64-bit only (E.G /usr/bin/chsh). Using the following command in the Terminal.app should return all of the files that are 32 bit that spotlight knows about:
mdfind "(kMDItemExecutableArchitectures == 'i386') && (kMDItemExecutableArchitectures != 'x86_64')"

    The second method uses the find command to locate any file that reports itself as an 'i386' executable. Using find is helpful for locating binaries that might not be in the spotlight database. It also works on systems where the spotlight database was disabled for some reason. Running the following command in the Terminal.app is likely to return more than you want to see, but I prefer to trim out things I don't care about rather than miss them completely:
find / -type f -perm +111 -exec file -p {} \; -exec head -c 1 /dev/zero \; | xargs -0 -n 1 sh -c 'echo "$@" | head -n 1' -- | grep -v x86_64 | grep -E Mach-O.+i386
     Both commands can be found on this StackExchange post: 

     Many thanks to the others who have helped explain and locate 32-bit apps. Hopefully, this information can be as helpful to others as it was for me! If anyone has a method for disabling this prompt on High Sierra that doesn't require the recovery partition, please let me know! Bonus points for a configuration profile!

No comments: