Created
September 1, 2026 09:44
-
-
Save alex-quiterio/ea46edbb7a5c3da8118257e4bf1a52a4 to your computer and use it in GitHub Desktop.
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
| #!/usr/bin/env bash | |
| # Print a summary of this Mac's hardware, OS and disk. | |
| set -euo pipefail | |
| bytes_to_gb() { echo "$(( $1 / 1024 / 1024 / 1024 )) GB"; } | |
| row() { printf ' %-14s %s\n' "$1" "$2"; } | |
| echo | |
| echo "Hardware" | |
| row "Model" "$(sysctl -n hw.model)" | |
| row "Chip" "$(sysctl -n machdep.cpu.brand_string)" | |
| total_cores=$(sysctl -n hw.ncpu) | |
| if performance=$(sysctl -n hw.perflevel0.physicalcpu 2>/dev/null); then | |
| efficiency=$(sysctl -n hw.perflevel1.physicalcpu 2>/dev/null || echo 0) | |
| row "Cores" "$total_cores ($performance performance + $efficiency efficiency)" | |
| else | |
| row "Cores" "$total_cores" | |
| fi | |
| row "Memory" "$(bytes_to_gb "$(sysctl -n hw.memsize)")" | |
| row "GPU" "$(system_profiler SPDisplaysDataType 2>/dev/null | awk -F': ' '/Chipset Model/ {print $2; exit}')" | |
| echo | |
| echo "System" | |
| row "OS" "$(sw_vers -productName) $(sw_vers -productVersion) ($(sw_vers -buildVersion))" | |
| row "Kernel" "$(uname -sr)" | |
| row "Arch" "$(uname -m)" | |
| row "Uptime" "$(uptime | sed -E 's/^ *[0-9:]+ +up +//; s/,? +[0-9]+ users?.*//')" | |
| row "Hostname" "$(scutil --get ComputerName 2>/dev/null || hostname)" | |
| echo | |
| echo "Storage" | |
| df -h / /System/Volumes/Data 2>/dev/null | awk 'NR>1 {printf " %-22s %s free of %s (%s used)\n", $9, $4, $2, $5}' | |
| echo | |
| echo "Battery" | |
| pmset -g batt 2>/dev/null | awk -F'\t' 'NR==2 {print " " $2}' | sed -E 's/ ?present: true//; s/;/ ·/g' || echo " n/a" | |
| echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment