Skip to content

fix: read memory on Darwin without free - #1660

Open
stantheman0128 wants to merge 1 commit into
RexOps:masterfrom
stantheman0128:darwin-memory-without-free
Open

stantheman0128 wants to merge 1 commit into
RexOps:masterfrom
stantheman0128:darwin-memory-without-free

Conversation

@stantheman0128

Copy link
Copy Markdown

Summary

Fixes #1367.

On Darwin, memory and swap fell through to the Linux default and ran free -m. This Mac has no free (command not found). Darwin now uses sysctl hw.memsize, vm_stat, and sysctl vm.swapusage. Values are megabytes, matching free -m. get cmdb was not run.

prepared with Cursor

Verification

Red, this Mac:

free -m
exit 127
free: command not found

Green:

bash xt/darwin-memory.sh
rex darwin ok total=16384 free=115 swap=1024 used=223 free_swap=800

total=16384 is hw.memsize in MiB. Swap matches vm.swapusage (1024.00M total, 223.19M used, 800.81M free).

Made with Cursor

Darwin fell through to the Linux path and ran free -m, which
is not installed, so cmdb printed command not found.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

Call to "get cmdb" on Darwin outside of a task throws bash error

1 participant