On an Apple OS X system, you can determine the amount of memory in the system by clicking on the Apple icon at the upper, left-hand corner of the screen and selecting "About This Mac".
If you need to determine the amount of memory from a shell prompt,
you can use the
$ sysctl -n hw.memsize 4294967296
sysctl -n hw.memsize command above shows my MacBook Pro
laptop running OS X 10.8.3 has 4 GB of memory (4294967296 bytes = 4 GB).
sysctl option you could use is to query
hw.physmem. But, be warned this will result in inaccurate results
on systems with more than 2 GB of memory.
E.g., checking the amount of physical memory with the command
sysctl -n hw.physmem on my MacBook Pro with 4 GB of memory
results in the command telling me the system has 2 GB of memory rather than
$ sysctl -n hw.physmem 2147483648
If you wish to have the number displayed in GB rather than bytes, you can
which is a simple python script to convert the output of
hw.physmem from bytes to gigabytes. You can run it from a shell
prompt by typing
$ python memsize.py 4 GB