Skip to content

MacOS support - #21

Open
amebru wants to merge 1 commit into
usgraphics:masterfrom
amebru:macos
Open

MacOS support#21
amebru wants to merge 1 commit into
usgraphics:masterfrom
amebru:macos

Conversation

@amebru

@amebru amebru commented Nov 6, 2025

Copy link
Copy Markdown

The other PRs with MacOS support have been dead for over a year, so I made a new one for my work.

Changelog

  1. /etc/os-release - replaced with sw_vers
  2. lscpu - replaced with sysctl
  3. /proc/cpuinfo and /proc/meminfo - linux virtual filesystems; replaced with macOS equivalents using sysctl and vm_stat
  4. lastlog - replaced with last
  5. uptime -p - macOS uptime doesn't support -p flag; manually calculated from boot time

These changes were intended to fix these errors that I got upon running the original version of the script:

/Users/amelia/.local/bin/machine_report.sh: line 235: /etc/os-release: No such file or directory
/Users/amelia/.local/bin/machine_report.sh: line 236: ${ID^} ${VERSION} ${VERSION_CODENAME^}: bad substitution
/Users/amelia/.local/bin/machine_report.sh: line 257: lscpu: command not found
/Users/amelia/.local/bin/machine_report.sh: line 258: lscpu: command not found
/Users/amelia/.local/bin/machine_report.sh: line 264: lscpu: command not found
/Users/amelia/.local/bin/machine_report.sh: line 265: lscpu: command not found
grep: /proc/cpuinfo: No such file or directory
grep: /proc/meminfo: No such file or directory
grep: /proc/meminfo: No such file or directory
awk: division by zero
 source line number 1
/Users/amelia/.local/bin/machine_report.sh: line 302: lastlog: command not found
uptime: illegal option -- p
usage: uptime

Output

┌┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┐
├┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┤
│          UNITED STATES GRAPHICS COMPANY          │
│              TR-100 MACHINE REPORT               │
├───────────────┬──────────────────────────────────┤
│ OS            │ macOS 15.7.1                     │
│ KERNEL        │ Darwin 24.6.0                    │
├───────────────┼──────────────────────────────────┤
│ HOSTNAME      │ MacBookAir                       │
│ MACHINE IP    │ 192.168.0.195                    │
│ CLIENT  IP    │ 20:40                            │
│ DNS  IP 1     │ 192.168.0.1                      │
│ DNS  IP 2     │ 2a02:8109:a391:3a00:10:18ff:f... │
│ USER          │ amelia                           │
├───────────────┼──────────────────────────────────┤
│ PROCESSOR     │ Intel(R) Core(TM) i3-1000NG4 CPU │
│ CORES         │ 4 vCPU(s) / 1 Socket(s)          │
│ HYPERVISOR    │ Bare Metal                       │
│ CPU FREQ      │ 1.10 GHz                         │
│ LOAD  1m      │ ██████████████████░░░░░░░░░░░░░░ │
│ LOAD  5m      │ ████████████████████████████████ │
│ LOAD 15m      │ ████████████████████████████████ │
├───────────────┼──────────────────────────────────┤
│ VOLUME        │ 10.00/233.00 GB [4.29%]          │
│ DISK USAGE    │ █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │
├───────────────┼──────────────────────────────────┤
│ MEMORY        │ 10.81/16.00 GiB [67.54%]         │
│ USAGE         │ █████████████████████░░░░░░░░░░░ │
├───────────────┼──────────────────────────────────┤
│ LAST LOGIN    │ Nov 6 20:46 -                    │
│ UPTIME        │ 6d 1m                            │
└───────────────┴──────────────────────────────────┘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant