MacOS – How to find out how many bytes of memory the machine has in RAM

macosmemorysystem-information

macOS Sierra's System Information.app tells me I have 12GB of RAM: two 4GB modules and two 2GB modules.

But I am aware of the following:

  • macOS might use either base 10 or base 2 to express RAM sizes. (https://support.apple.com/en-us/HT201402 only talks about storage, not RAM)
  • RAM is physically designed such that the actual number of bytes might not be a power of 2. It could, for example, be a multiple of some power of 2.

These are both uncertainties, not facts. In order for me to calculate how many bytes I have, I need to know whether OS X is using gigabytes or gibibytes, and whether I need to use multiples of them or powers of them.

Thanks!

Best Answer

RAM is always calculated in base 2.

In Terminal:

sysctl hw.memsize

The output will be in bytes.