Reading physical memory details in MacOS App programmatically

is there any cocoa API available using which we can get below details of physical memory?

Able to get this data using system_profiler SPMemoryDataType but looking for API instead of command since this command do not return all above data for Apple M1 machine.

What are you planning to do with this info?

If this is purely for logging purposes — say you’re creating an asset management product and want it return info about the Mac’s memory setup – I think running the system_profiler tool is your best option. Don’t forget to specify the -xml option to get parseable output.

since this command do not return all above data for Apple M1 machine.

It doesn’t return all that info on my Intel MacBook Pro either. The reality is that much of this info doesn’t make sense in a world of integrated (Intel) and SOC (Apple silicon) memory.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

AFAIK, we can add/remove the RAM from the Mac system

Only some Mac systems. The majority of modern Macs have non-replaceable memory (either integrated or SOC).

On the API front, AFAIK there are no APIs that returned detailed information about the RAM configuration. You may be able to find some info in the I/O Registry but I need to caution you on that front: I/O Registry entries are only considered API if they’re documented (in either the documentation or the macOS SDK headers). The I/O Registry includes a lot of entries that are not considered API. If you build a product that relies on them, you will run into compatibility problems down the line.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Reading physical memory details in MacOS App programmatically
 
 
Q