Skip to content

How to Detect macOS > 10.15.7

Reported macOS Version Is No Longer Reliable

It's currently impossible to detect macOS versions newer than 10.15 using only the user-agent string. This issue is primarily caused by macOS version being capped at 10.15 on all major browsers:

INFO

Since rolling out its user-agent reduction program, Chromium-based browsers in macOS will always identify itself as Macintosh; Intel Mac OS X 10_15_7 for all of these macOS versions:

  • macOS 10.15 (Catalina)
  • macOS 11 (Big Sur)
  • macOS 12 (Monterey)
  • macOS 13 (Ventura)
  • macOS 14 (Sonoma)
  • macOS 15 (Sequoia)
  • macOS 26 (Tahoe)

Detecting the Real macOS Version with UAParser.js

Luckily, there is a kind of workaround by utilizing client hints feature:

js
import { UAParser } from 'ua-parser-js';

const uap = new UAParser();
let os = uap.getOS();

console.log('Based on user agent: ', os); 
// { name: "macOS", version: "10.15.7" }

uap.getOS().withClientHints().then(os => {
    console.log('Based on client hints', os); 
    // { name: "macOS", version: "11" }
});

LIMITATION

Client hints feature is only supported in Chromium-based browsers (Chrome, Edge, etc.). In other browsers like Firefox and Safari, withClientHints() gives no effect to the result and still detected as macOS 10.15.7.

References:

UAParser.js v2 is licensed under AGPLv3 or PRO licenses.