The documentation lists some "typical values", but it leaves out some; e.g. "Windows-x86-64". Also, if the main difference between the two variables is that $OperatingSystem doesn't distinguish between versions of the same operating system, under what circumstances will $SystemID return plain "Windows"?

  • 1
    $\begingroup$ There is no reliable complete list of values because Mathematica could always be released for one more platform (as it has been released for Raspberry Pi and recently a beta for iPad). $\endgroup$
    – Szabolcs
    Jan 8 '17 at 13:18

The purpose of $OperatingSystem is to check what general OS you are on. You would check $OperaingSystem for tasks such as determining whether to extract a system setting from the registry (Windows only) or elsewhere, whether to run which.exe or where to find the location of an executable, whether to use / or \ as a path separator (although for this we have $PathnameSeparator), etc.

The purpose of $SystemID is to distinguish between incompatible system types. Thus $SystemID will be different not only for operating systems, but also for processor types or for different OS ABIs. You would check $SystemID before deciding which LibraryLink library to load, which MathLink executable to Install, which MX file to load, etc., as all these are architecture dependent, and will not be compatible between a 32 and 64 bit version of the same operating system, or between different processor types (e.g. ARM vs x86). In fact, Mathematica already looks for certain files (shared libraries, MX files) in locations that depend on $SystemID.

In the practical use cases I can think of you will not need to check for a specific value of $SystemID unless you have access to that system. For example, if you don't have access to that system, you can't create MX files for it, or compile executables or shared libraries for it.

Here is a list of currently used $SystemIDs that I could gather. I am not 100% certain that all these are correct. These are gathered from various places.

  • Windows, 32-bit, Intel: Windows
  • Windows, 64-bit, Intel: Windows-x86-64
  • OS X, 64-bit, Intel: MacOSX-x86-64
  • OS X, 32-bit, Intel: MacOSX-x86. There are no 32-bit Intel versions of M for OS X at this moment.
  • OS X, PowerPC: MacOSX. Not in use anymore—Apple stopped using PowerPC processors in 2006.
  • OS X, ARM (Apple Silicon): MacOSX-ARM64
  • Linux, 32-bit, Intel: Linux
  • Linux, 64-bit, Intel: Linux-x86-64
  • Linux, 32-bit, Raspberry Pi: Linux-ARM
  • 2
    $\begingroup$ "MacOSX" would be the $SystemID for the PowerPC architecture, and "MacOSX-x86" for 32-bit Intel OS X. Of course, both of them are not currently used. $\endgroup$
    – ilian
    Feb 6 '17 at 16:54
  • $\begingroup$ @ilian What is returned by $SystemID for Mathematica 12.3.1 running on Mac OS with Apple Silicon? Thanks. $\endgroup$
    – QuantumDot
    Jul 10 '21 at 23:56
  • $\begingroup$ It should be "MacOSX-ARM64" $\endgroup$
    – ilian
    Jul 11 '21 at 1:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.