2

I think Activity Monitor can be used for managing/monitoring processes, but I am confused about the other four: disk/memory/IO/file.

Are all these four functions be managed/monitored out by Disk Utility?

2
  • I'm not sure what you mean by "responsible for" -- Activity Monitor is what you'd use to view processes (and can also kill them, though there are other ways to do that), but it doesn't play any role in normal operation (i.e. when you're not running it). Are you talking about normal (invisible/background) management, or what gives you access to see/control what's going on? – Gordon Davisson Apr 23 at 4:40
  • Thanks for the comment, and sorry for causing misunderstandings. I was actually trying to ask the latter, namely, the built-in utilities available for a user to manage or monitor those functions. – charlesw Apr 23 at 5:25
7

There are a lot of tools, both in the graphical interface and at the command line, for viewing and configuring these various parts of macOS' operations. I'll give you a summary of the most relevant ones.

For viewing processes in the GUI, Activity Monitor is the primary tool. It can also view other per-process things like memory usage, and disk and network activity (and it also gives some overall stats at the bottom of the window). You can also view open files and network ports for processes you own by selecting them, and clicking the Inspect (circle-with-an-"i"-in-it) button in the toolbar, then selecting the Open Files and Ports tab. And it can kill (force-exit) running programs.

At the command line, top is my favorite tool. I use top -u -s5 to show top CPU-using processes (updated every 5 seconds, because the default of 1 second is too fast). top -orsize will show top "real memory" usage instead. And it shows overall stats at the top of the screen. ps is the other main tool; by default, it only shows your command-line processes, so use ps -A (or -ax or -e) to show all processes. Check the man page for lots more options. You can use kill to kill processes by PID, or killall to kill them by name (/program). (Warning: on some other OSes, killall does different, and much more lethal, things, so think before you type.)

A lot of the process management in macOS (especially running background processes) is handled by launchd, and you can query and manage it from the command line with launchctl (warning: this can be a bit confusing). Apple doesn't provide a GUI for interacting with this, but there is a third-party option: LaunchControl from soma-zone.

For memory: since that's pretty much used by processes, use the process monitoring tools to see what's going on. You can get some whole-system virtual memory stats from vm_stat (warning: these stats are in pages, not KB or MB or anything like that) or sysctl vm.swapusage (or if you want to drink from the firehose, sysctl -a vm). Memory management is thoroughly automated, so there aren't really any tools to configure it.

For disks: Disk Utility is the GUI tool of choice, both to see how things are formatted and to make changes (erase/format/partition/etc). At the command line, diskutil is its counterpart.

For files: if you just want to look around, it's Finder in the GUI. Apple makes a fair bit of the filesystem invisible in the Finder (which is sort of a "don't mess with this unless you know what you're doing" indication); if you want to see the normally-hidden parts, you can toggle show-all mode with Command-Shift-Period (this also works in standard open and save file dialogs). At the command line, it's ls (I use ls -AleO@ to show hidden files and various obscure attributes).

If you want to see what files (/folders) are taking up all your space, you can get a basic summary with Apple menu > About This Mac > Storage tab, and a little more info by clicking the Manage button there. There are a bunch of third-party utilities that give more detail. At the command line, it's df to show which volumes are getting full (df -h for human-readable sizes), and du to see how much space is used by each subfolder (and subsubfolder and...) (I mostly use sudo du -xhd1 /path/to/folder to give a human-readable listing that only goes one folder level deep). Note that you'll need to grant the Terminal Full Disk Access to let its commands see into "private" areas of the filesystem.

For file activity, in addition to Activity Monitor, you can use lsof to get a (huge) snapshot of which files are open (it las lots of flexible -- and confusing -- options), and fs_usage to get an (extremely detailed) running log of file accesses.

For I/O, it really depends on the type of I/O you're interested in. If you want to see what's connected, System Information (click the Apple menu, hold the Option key and choose System Information) will give you a huge amount of information about the system's configuration (and not just about I/O devices/attachments). system_profiler is its command-line counterpart.

You can use iostat to look at I/O throughput per device (mostly disk access).

For network I/O, use the per-process tools above (and sudo lsof -i to see open network ports). To view and change the network connection settings, use the System Preferences -> Network pane and its command-line counterpart networksetup. For detailed network status, use the Network Utility, netstat, and ifconfig.

Other I/O... is rather scattered around. Several types, like Bluetooth, Displays, Sound, etc have panes in System Preferences. If you have a specific type you're interested in, you'd have to specify it.

4
  • 1
    For files, when viewing in the Finder (GUI), I'd add the shortcut shift-command-. to toggle hidden file visibility. – da4 Apr 23 at 14:58
  • @da4 Good idea; added. – Gordon Davisson Apr 23 at 16:57
  • 2
    For memory, there is vm_stat and I/O has iostat - at least up through 10.14 Mojave. – aMike Apr 23 at 18:12
  • @aMike Also added. – Gordon Davisson Apr 23 at 20:34
0

No, the Mach kernel carries out all the operations. The apps just look at counters and report what the kernel has done.

2
  • Thanks. Then, does Disk Utility report all that has been done by the kernel on disk/memory/io/file management? Or just some of these four? – charlesw Apr 23 at 3:26
  • I guess it depends on what you meant by “carried” which is now edited out of the question. @charlesw – bmike Apr 23 at 11:41

You must log in to answer this question.

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