To inspect RAM memory on macOS there are alternatives to vmstat
or free
on Linux: vm_stat
and top
(actually it's exists on both systems).
To check free RAM on macOS:
$> top -l 1 -s 0 | grep PhysMem
It will show you occupied physical memory and available once.
Either you can run this:
$> vm_stat | perl -ne '/page size of (\d+)/ and $size=$1; /Pages\s+([^:]+)[^\d]+(\d+)/ and printf("%-16s % 16.2f Mi\n", "$1:", $2 * $size / 1048576);'
It will show information in pages by default, but perl script provide output in human readable format.
References: