14

Sometimes I need to gather information about the client's server prior to making real work there, i.e. getting info on CPU type and activity. On Linux there is mpstat and /proc/cpuinfo, both of them don't seem to exist on Mac OS X server. Any alternatives ?

6 Answers 6

17

Lots of people have already mentioned system_profiler, so I'll just list some other commands I'd recommend for "looking around" a Mac OS X system:

top -u -s5

My favorite command for seeing what's going on. Shows processes sorted by CPU usage, updated every 5 seconds (I find the default of 1 second to be too fast), as well as load average, physical & VM stats, etc. Replace -u with -orsize to sort by resident memory size instead.

sysctl vm.swapusage

VM stats -- see man sysctl for other options, or just try -a and look through the whole list.

sw_vers

Shows the OS version and build

softwareupdate -l

Polls an Apple server for a list of relevant software updates. -i -a will download and install them. Note that it will not restart the computer for updates that require it; instead they will be marked with "[restart]" in the list, and you'll need to restart manually after installing them (but be wary of firing off updates that require a reboot when you don't have physical access to the computer -- If something goes wrong you could be in trouble).

systemsetup
networksetup

Command-line access to the general and network settings normally accessed by the System Preferences GUI app. Useful, but have the most amazingly (and painfully) verbose options I've ever seen. (I mean, -getdisablekeyboardwhenenclosurelockisengaged? Really?)

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart

Command-line control for the remote management service (Apple Remote Desktop), which doubles as a VNC server if you need GUI access. The trick is that to make it work with a generic VNC client, you have to enable "legacy"-style authentication, with something like:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopt -setvnclegacy -vnclegacy yes -setvncpw -vncpw PWGoesHere -restart -agent

(Or, if it's not already running, use -activate instead of -restart -agent)

10
system_profiler
  • Found at /usr/sbin/ will give you bunch of info about the server/computer (I tried it on Leopard, not sure if that's the same for Tiger)
top -o cpu
  • For live Activity of the CPU

You might be able to find more useful commands for OS X at this SF post: https://serverfault.com/questions/7346/useful-commandline-commands-on-mac-os

8

/usr/sbin/system_profiler -detailLevel full SPHardwareDataType

Should give you the type information.

8

"iostat -1" will give you some basic cpu activity stats (although not broken down by individual CPU in a multi-cpu box).

1
  • as of macOS Catalina, iostat -1 doesn't work, but I used iostat -n0 -c 3 instead. Compared to top, this consumes barely any cpu. However you need a few samples to get a more accurate view of cpu usage (3 in my example)
    – Chris
    Jul 7, 2021 at 21:34
1

To get detailed information on CPU features, you can go low-level with sysctl:

sysctl -a | grep cpu
-1

sysctl machdep.cpu.brand_string

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .