On Linux console it’s easy to get free memory with
free -m. On Mac the utility is not directly available. The alternative is to fetch it from
Ruby port of
There’s a great small Ruby script to do the job and display free memory in a simplistic form with a command
free in a following few steps:
- Copy it to a folder on your Mac, e.g. to
Create an alias for a free command by editing the bash profile in Terminal:
$ nano ~/.bash_login
At the end of the file, add
alias free='ruby /Applications/Utilities/free-memory.rb'
Make the change available
$ source ~/.bash_login
You’re done. Type
free and you’ll see something like
3.98G of 8.19G free.