MacIosInfo

Resolve a macOS build number (the value Xcode writes into BuildMachineOSBuild, e.g. 24G830) into a macOS version and marketing name.

MacIosInfo.macos_build_to_macos_version(build_number: "24G830") #=> "15.7.9"
MacIosInfo.macos_build_to_os_name(build_number: "24G830")       #=> "macOS Sequoia"
MacIosInfo.macos_version_to_os_name(version: "15.7.9")          #=> "macOS Sequoia"

Installation

Add this line to your application's Gemfile:

gem 'mac_ios_info'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install mac_ios_info

Usage

macos_build_to_macos_version

Returns the exact macOS version for a known build number.

MacIosInfo.macos_build_to_macos_version(build_number: "20D80")  #=> "11.2.2"
MacIosInfo.macos_build_to_macos_version(build_number: "24C101") #=> "15.2"
MacIosInfo.macos_build_to_macos_version(build_number: "25G83")  #=> "26.6.2"

A build number begins with the Darwin (kernel) major version, so when a build is not in the table the major version is still derived from it rather than giving up:

# a point release published after this gem was updated
MacIosInfo.macos_build_to_macos_version(build_number: "25Z999") #=> "26"

"UnKnown" is only returned when even the release family cannot be determined:

MacIosInfo.macos_build_to_macos_version(build_number: "99A1")   #=> "UnKnown"

macos_build_to_os_name

Goes straight from a build number to the marketing name. This works for every build of a known release family, including ones not in the version table.

MacIosInfo.macos_build_to_os_name(build_number: "24A335") #=> "macOS Sequoia"
MacIosInfo.macos_build_to_os_name(build_number: "24Z999") #=> "macOS Sequoia"

macos_version_to_os_name

MacIosInfo.macos_version_to_os_name(version: "10.13.5") #=> "macOS High Sierra"
MacIosInfo.macos_version_to_os_name(version: "11.2.2")  #=> "macOS Big Sur"
MacIosInfo.macos_version_to_os_name(version: "26.6.2")  #=> "macOS Tahoe"
MacIosInfo.macos_version_to_os_name(version: "15")      #=> "macOS Sequoia"

Supported releases

Darwin macOS Name
16 10.12 macOS Sierra
17 10.13 macOS High Sierra
18 10.14 macOS Mojave
19 10.15 macOS Catalina
20 11 macOS Big Sur
21 12 macOS Monterey
22 13 macOS Ventura
23 14 macOS Sonoma
24 15 macOS Sequoia
25 26 macOS Tahoe

Exact build numbers are listed for macOS High Sierra through macOS Tahoe. Builds outside that table resolve to the release family via the Darwin major version, so a new macOS release does not have to be added here before it reports correctly.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/tarappo/mac_ios_info. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the MacIosInfo project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.