Macos – Mac OS X sysctl get total and free memory size

command linemacosmemory

How to get on MAC OS X using sysctl used and free memory ? Searched for sysctl -a | grep vm or sysctl -a | grep mem but didn't found anything relevant.

Best Answer

You don't.

Well, except for total memory size, which you could have found with sysctl -a | grep mem (hw.memsize = 4294967296 on my machine).

vm_stat displays the same information as Activity Monitor.app does, you just need to multiply the value you want by page size. Both are provided in the output.

Related Question