Launch Services Database; 64 bit vs 32 bit on 10.5.x

by

Dad was working on a Mac Application and put in the entries in the info.plist so that the application would launch as 32bit in 10.5.x and 64 bit in 10.6 and later.  Unfortunately, it wasn’t doing the right thing and it took some detective work to track it down.

Turns out this application was using a slightly modified version of Chris Campbell’s SystemVersionCheck shim and it launches the real executable via execv which seems to ignore LSMinimumSystemVersionByArchitecture and code>LSArchitecturePriority and always seems to launch the first architecture in the application executable (not 100% sure on what rules it uses to decide).

What works without the system check launch thing is this:

  <key>LSArchitecturePriority</key>
  <array>
    <string>x86_64</string>
    <string>i386</string>
    <string>ppc</string>
    <string>ppc64</string>
  </array>
  <key>LSMinimumSystemVersionByArchitecture</key>
  <dict>
    <key>x86_64</key>
    <string>10.6</string>
  </dict>

While trying to track this down I ended up wanting to purge the entries in the Launch Services database. The lsregister tool is used to do this, and there is an applescript out there that’ll do it with a GUI and force a complete rebuild. If you want a more surgical approach, you can use commands like:

./lsregister -dump > ~/Desktop/ls_dump

to get a dump of the launch services database to figure out what’s going on. Note that ./lsregister -h provides helpful information.

I ended up using the ./lsregister -f -r -v -u {path_to_parent_folder} version of the args to unregister an old bogus entry (and -v to see what was going on). Note that you can’t get rid of an entry at a path that no longer has the file – I had to put a copy of the app into the trash, run the -u version and then quickly empty the trash in order to get rid of an entry referencing it there.

In 10.5.x this tool is in the LaunchServices.framework/Support/ folder. LaunchServices is in CoreServices.framework/Frameworks/

or (sorry about formatting)

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/ 

Note that in 10.6 this tool has moved to

/System/Library/Frameworks/ApplicationServices.framework/Frameworks/LaunchServices.framework/Support/

and may have other commands (I was working in 10.5.8).

ok. Now I can find this info again when I forget 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: