Not suitable image found when executing osascript ?

Tuesday, August 03 2010 @ 11:47 AM BST

Contributed by: Admin

If you got some "verbose" messages like "Error loading /Library/ScriptingAdditions … no suitable image found." when executing osascript when within your bash scripts… here is a solution…

You have this kind of message:

Error loading /Library/ScriptingAdditions/SOME_EXTENSION_NAME.osax/Contents/MacOS/SOME_EXTENSION_NAME:  dlopen(/Library/ScriptingAdditions/SOME_EXTENSION_NAME.osax/Contents/MacOS/SOME_EXTENSION_NAME, 262): no suitable image found.
because your ScritpingAdditions folder contains some 32-bits only OSAX when SnowLeopard expects 64-bits one…

A quick solution is to add "arch -i386" in front of your osascript invocations in your Shell scripts, example:

arch -i386 osascript -e 'tell application "someAppl" to quit'