Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
macos-release
Advanced tools
Get the name and version of a macOS release from the Darwin version
The macos-release npm package is used to get the macOS name and version from the Darwin version. It is useful for applications that need to display or log the macOS version in a human-readable format.
Get macOS release name and version
This feature allows you to get the macOS release name and version. The code sample demonstrates how to use the macos-release package to get the current macOS release information and log it to the console.
const macosRelease = require('macos-release');
const release = macosRelease();
console.log(release);
Get macOS release name and version from a specific Darwin version
This feature allows you to get the macOS release name and version from a specific Darwin version. The code sample demonstrates how to use the macos-release package to get the macOS release information for Darwin version '20.3.0' and log it to the console.
const macosRelease = require('macos-release');
const release = macosRelease('20.3.0');
console.log(release);
The os-name package provides the name of the operating system. It supports multiple platforms including macOS, Windows, and Linux. Compared to macos-release, os-name is more versatile as it can be used across different operating systems, but it may not provide as detailed information specifically for macOS.
The os-release package is used to get the operating system release information. It is similar to macos-release but is more general-purpose and can be used on various Unix-like operating systems. It may not provide the specific macOS release names but is useful for broader OS detection.
Get the name and version of a macOS release from the Darwin version
Example:13.2.0
→{name: 'Mavericks', version: '10.9'}
npm install macos-release
import os from 'node:os';
import macosRelease from 'macos-release';
// On a macOS Sierra system
macosRelease();
//=> {name: 'Sierra', version: '10.12'}
os.release();
//=> 13.2.0
// This is the Darwin kernel version
macosRelease(os.release());
//=> {name: 'Sierra', version: '10.12'}
macosRelease('14.0.0');
//=> {name: 'Yosemite', version: '10.10'}
macosRelease('20.0.0');
//=> {name: 'Big Sur', version: '11'}
Type: string
By default, the current operating system is used, but you can supply a custom Darwin kernel version, which is the output of os.release()
.
macOS Sierra
10.9.3
5.1.2600
→ XP
FAQs
Get the name and version of a macOS release from the Darwin version
The npm package macos-release receives a total of 2,122,726 weekly downloads. As such, macos-release popularity was classified as popular.
We found that macos-release demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.