osacompile behaves differently in macOS 11 beta 9

Hello, I'm using osacompile to compile and AppleScript to an .App file and use it in my application.

Code Block
osacompile -x -o "Application.app" "AppleScript.scpt"

So, when I compile the scpt in macOS Catalina, it works well and good.

The problem is after compiling the same app in macOS Big Sur, now the compiled app works well in macOS 11 but not on macOS Catalina. The same app does not run stating that minimum macOS requirement is not satisfied. Something which goes like this,


You can’t use this version of the application “Application.app” with this version of macOS.
You have macOS 10.15.7. The application requires macOS 11.0 or later.

The underlying problem was the load command LC_VERSION_MIN_MACOSX is not present in the objdump of the excitable built form macOS 11, it instead has LC_BUILD_VERSION set to 11.0

Code Block
otool -l <path to executable>

The executable from Catalina has LC_VERSION_MIN_MACOSX set to 10.6 and works fine because of that.

And surprisingly, when I try in one another macOS 11 machine the LC_VERSION_MIN_MACOSX load command gets emitted and set to 10.6

So what is the ideal behaviour of osacompile, is it reliable to use. From where are these load commands getting emitted?

Looks like osacomplile does to honour MACOS_DEPLOYMENT_TARGET environmental variable nor it has any compile time flags that can be set like in gcc (-mmacosx-min-version)

Someone please guide me through this. Thanks in advance.
I’m not able to reproduce this. I tried on both 11.0b9 and 11.0b10. After compiling a minimal AppleScript here’s what I see:

Code Block
% osacompile -x -o app.app app.scpt
% otool -l app.app/Contents/MacOS/applet | grep -B 1 -A 3 VERSION
Load command 9
cmd LC_VERSION_MIN_MACOSX
cmdsize 16
version 10.6
sdk 11.0


From where are these load commands getting emitted?

The system creates the script’s main executable by copying /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/OpenScripting.framework/Versions/A/Resources/AppletStub. Notably, this has the load command set correctly too:

Code Block
% cd "/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/OpenScripting.framework/Versions/A/Resources"
% otool -l AppletStub | grep -B 1 -A 3 VERSION
Load command 9
cmd LC_VERSION_MIN_MACOSX
cmdsize 16
version 10.6
sdk 11.0


Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Hi @eskimo, That was of great help. I'm now able to figure out the problem on why my macOS 11 does not have the LC_VERSION_MIN_MACOSX, the AppletStub was not having it too.

Is there a way to change it? I tried to copy the Carbon.Framework from a working macOS 11 to the problematic one, but we can't do that as it is a System Framework. Any idea how this would be rectified?

And I'm not sure how this load command got messed up in the first place. BTW the problematic machine was running a older beta, will try to upgrade it to beta10 and see if that fixes it.

Thanks for your support.

the problematic machine was running a older beta, will try to upgrade
it to beta10 and see if that fixes it.

I suspect that this was a bug on our part. When we build macOS we build it as a whole, so everything gets the same deployment target, code signing options, and so on. That’s fine for most code but it won’t work for a situation like this. I suspect that the old version of 11.0 beta you’re using was built incorrectly and we fixed that during the beta cycle.

But, yeah, updating the problematic machine to the latest beta should fix this. If it doesn’t, I recommend wiping the machine and re-installing the latest beta from scratch. If that doesn’t fix it then, yeah, this is a serious mystery (-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Confirming that update to the latest beta i.e. macOS 11 developer beta 10 (latest of of now) solved it. Now the AppletStub has the correct load commands in it. Thanks for help!
osacompile behaves differently in macOS 11 beta 9
 
 
Q