pythonmacoshardwareramsystem-information

How do I get the RAM manufacturer on MacOS using Python 3?


I'm working on a benchmarking application, and I thought it would be useful if users could see the manufacturer of their RAM. I came across this post: Get ram manufacturer, which was very helpful for finding the manufacturer on Windows. However, it didn't answer the question of how I would get the manufacturer of RAM on MacOS.

I came across many libraries for finding system information, such as psutil and system-info. However, none of the libraries I found could find the manufacturer of RAM on MacOS.

I also tried running system_profiler SPHardwareDataType from Python, but that only returns information for the amount of memory installed, not the manufacturer of the memory.

However, I do see that in the "System Information" application on MacOS, you can view the manufacturer of your RAM, as shown in this screenshot: https://i.sstatic.net/rGgwv.png. But that still doesn't solve the problem of how I would get the manufacturer from that application into Python.

Any help would be appreciated. Thanks in advance!


Solution

  • system_profiler SPMemoryDataType should have the info you need.

    Here's the output on my machine, that matches the screenshot you provided, but that you can easily parse.

    Memory:
    
        Memory Slots:
    
          ECC: Disabled
          Upgradeable Memory: No
    
            BANK 0/ChannelA-DIMM0:
    
              Size: 16 GB
              Type: DDR4
              Speed: 2400 MHz
              Status: OK
              Manufacturer: Micron
              Part Number: 16ATS2G64HZ-2G6B1
              Serial Number: -
    
            BANK 2/ChannelB-DIMM0:
    
              Size: 16 GB
              Type: DDR4
              Speed: 2400 MHz
              Status: OK
              Manufacturer: Micron
              Part Number: 16ATS2G64HZ-2G6B1
              Serial Number: -