Disable app run on versions below 10.5

Is there any way to prevent an app launching if the OS version of the machine is below 10.5? I have an app that is compiled that does not support anything below 10.5 so I need to prevent it from running on older versions.

Hi,

check the system version while launching and quit the app, if the version is below Leopard


if ((system attribute "sysv") mod 4096 div 16) < 5 then quit

Thank you very much I will try that!

Add [url=http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html#//apple_ref/doc/uid/20001431-113253]LSMinimumSystemVersion[/url] to your app’s Info.plist.

<key>LSMinimumSystemVersion</key> <string>10.5.0</string>

Both solutions work, however the LSMinimumSystemVersion for some reason doesn’t display an error, just quits the program on launch. The other one works perfectly, but thanks to you both for helping, this forum is great and the help is much appreciated!

Starting in 10.4 you can get system information with the following. There’s lots of good stuff in there.

get system info

Part of the system information is the system version therefore this will get it.

set sysver to system version of (system info)

Therefore you can do something like the following. Note that if the person has less than 10.4 and the “system info” command will error so in those cases we just return false which makes our commands work.

set sysCheck to my checkSystemRequirements("10.5")
if sysCheck is false then
	display dialog "I'm sorry but I only run on MacOS X 10.5 or higher" buttons {"OK"} default button 1 with icon 0
	do shell script "killall MyAppName"
end if


on checkSystemRequirements(minReq) -- makes sure the app will only run on 10.5 or later machines
	try
		set sysVersion to system version of (system info)
		if sysVersion < minReq then
			return false
		else
			return true
		end if
	on error
		return false
	end try
end checkSystemRequirements