Applescript seems to run in Rosetta on M2

When calling a perl script from an apple script (by dropping a file on it), I get the error:

Can't load '/Library/Perl/5.34/darwin-thread-multi-2level/auto/Encode/Encode.bundle' for module Encode: dlopen(/Library/Perl/5.34/darwin-thread-multi-2level/auto/Encode/Encode.bundle, 0x0001): tried: '/Library/Perl/5.34/darwin-thread-multi-2level/auto/Encode/Encode.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Perl/5.34/darwin-thread-multi-2level/auto/Encode/Encode.bundle' (no such file), '/Library/Perl/5.34/darwin-thread-multi-2level/auto/Encode/Encode.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) at /System/Library/Perl/5.34/XSLoader.pm line 96. at /Library/Perl/5.34/darwin-thread-multi-2level/Encode.pm line 12.

When I call the script manually from terminal, it runs fine.

Why is Applescript running as X86 on M2?

Answered by DTS Engineer in 802512022

Try this:

  1. In Script Editor, create a new script like so:

    display dialog "Hello Cruel World!" buttons {"OK"} default button "OK"
    
  2. Save it as an application.

  3. Launch it from the Finder.

  4. Run Activity Monitor and, in the CPU tab, look for the value in the Kind column.

It should show Apple (for Apple silicon). What do you see?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Try this:

  1. In Script Editor, create a new script like so:

    display dialog "Hello Cruel World!" buttons {"OK"} default button "OK"
    
  2. Save it as an application.

  3. Launch it from the Finder.

  4. Run Activity Monitor and, in the CPU tab, look for the value in the Kind column.

It should show Apple (for Apple silicon). What do you see?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I interpret the error in a different way.

Can't load Perl Encode.bundle ... trie another ... failure ... ... trie another ... failure, can't find the other ... trie another ... failure

and each time (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

I read this as, tried to open Perl encode.bundle, it's a mach-o file and you have 64 while this file needs x86_64.

Looks like a Perl issue not a AppleScript issue. Don't know the script and thus don't know how you make the call to Perl.

Applescript seems to run in Rosetta on M2
 
 
Q