Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Utility to give system info about a Mac
#!/usr/bin/env python
# Little command-line utility for telling you stuff about your Mac without
# having to click around all over the place. Originally found here and
# then cleaned up significantly:
import sys
import commands
import plistlib
'machine_name': 'Machine Name',
'machine_model': 'Model',
'serial_number': 'Serial Number',
'physical_memory': 'Physical RAM',
'number_processors': 'Number of CPUs',
'current_processor_speed': 'CPU Speed',
'SMC_version': 'SMC Version',
'boot_rom_version': 'Boot ROM Version',
'l2_cache': 'L2 Cache',
# 'spdisplays_rom-revision': 'GPU ROM Version',
def main():
in_profile = commands.getstatusoutput('system_profiler -xml')
if len(in_profile) < 2:
sys.stderr.write("Error generating system profile!\n")
parsed = plistlib.readPlistFromString(in_profile[1])
d = parsed[0].items()[5][1][0]
print '\n'.join(["%20s: %s" % (k, v)
for (k, v) in [(label, d[key])
for key, label in SYSTEM_KEYS.items()
if key in d]])
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.