Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect if app is running on a macOS beta version

I would like to be able to somehow detect if my app is running on a beta version of macOS 11, as there are some known bugs I want to inform users about. I only want to show such an alert to macOS 11 beta users, meaning not macOS 10.15 users nor users on the final version of macOS 11. I could of course just submit an app update to remove the alert when macOS 11 is close to being done, but it would be nice to have something reusable I could use in multiple apps and for future macOS beta versions.

Constraints:

  • The app is sandboxed.
  • The app is in the App Store, so no private APIs.
  • The app doesn't have a network entitlement, so the detection needs to be offline.
  • I don't want to bundle a list of known macOS build numbers and compare that.

My thinking is that maybe it's possible to use some kind of sniffing. Maybe there are some APIs that return different results when the macOS version is a beta version.

like image 533
Sindre Sorhus Avatar asked Sep 15 '25 07:09

Sindre Sorhus


1 Answers

I believe you're out of luck. About This Mac uses PrivateFrameworks/Seeding.framework, here the important disassembly:

/* @class SDBuildInfo */
+(char)currentBuildIsSeed {
    return 0x0;
}

So it seems this is a build time compiler flag. The plists in the framework don't contain this flag unfortunately.

Sample private API usage: kaloprominat/currentBuildIsSeed.py

For the crazy ones: It would be possible to read the binary and compare the assembly for the function. I'd start with the class-dump code, which gets you different fat binaries and the function offset.

like image 69
catlan Avatar answered Sep 17 '25 02:09

catlan