-
-
Save hyuki/97a1cd290c37a7768ddaa83b6aaf301b to your computer and use it in GitHub Desktop.
macversion - macOSのバージョン、ビルド番号、CPUアーキテクチャを表示するスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Get macOS version, build, and architecture | |
| version=$(sw_vers -productVersion) | |
| build=$(sw_vers -buildVersion) | |
| arch=$(uname -m) | |
| # Determine CPU architecture label | |
| if [ "$arch" = "arm64" ]; then | |
| cpu="Apple Silicon (arm64)" | |
| else | |
| cpu="Intel (x86_64)" | |
| fi | |
| # Determine macOS codename from version | |
| macos_codename() { | |
| case "$1" in | |
| 10.15*) echo "Catalina" ;; | |
| 11.*) echo "Big Sur" ;; | |
| 12.*) echo "Monterey" ;; | |
| 13.*) echo "Ventura" ;; | |
| 14.*) echo "Sonoma" ;; | |
| 15.*) echo "Sequoia" ;; # macOS 15.0 was officially announced as Sequoia | |
| *) echo "(unknown codename)" ;; | |
| esac | |
| } | |
| codename=$(macos_codename "$version") | |
| # Output | |
| echo "macOS Version: $version ($codename)" | |
| echo "Build Number: $build" | |
| echo "CPU Architecture: $cpu" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ macversion
macOS Version: 15.4.1 (Sequoia)
Build Number: 24E263
CPU Architecture: Apple Silicon (arm64)