What is macos-release?
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.
What are macos-release's main functionalities?
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);
Other packages similar to macos-release
os-name
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.
os-release
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.
macos-release
Get the name and version of a macOS release from the Darwin version
Example: 13.2.0
→ {name: 'Mavericks', version: '10.9'}
Install
npm install macos-release
Usage
import os from 'node:os';
import macosRelease from 'macos-release';
macosRelease();
os.release();
macosRelease(os.release());
macosRelease('14.0.0');
macosRelease('20.0.0');
API
macosRelease(release?)
release
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()
.
Related
- os-name - Get the name of the current operating system. Example:
macOS Sierra
- macos-version - Get the macOS version of the current system. Example:
10.9.3
- windows-release - Get the name of a Windows version from the release number:
5.1.2600
→ XP