I created this method based on a Shell. It works whether the app itself is translated or not.
Function IsAppleARM() As Boolean
#if not TargetMacOS then
return false
#else
dim sh as new Shell
sh.Execute "/usr/sbin/sysctl -a | grep 'brand_string'"
if sh.ErrorCode <> 0 then
dim err as new RuntimeException
err.Message = "Could not run sysctl"
err.ErrorNumber = sh.ErrorCode
raise err
end if
dim result as string = sh.Result.DefineEncoding( Encodings.UTF8 )
return result.InStr( "Apple" ) <> 0
#endif
End Function
(Note: This intentionally uses API 1 calls as it is in freeware meant to work in older versions too.)
Edit: Removed “M1” from the search string based on Christian’s suggestion below.