How to enable process accounting on macOS
Solution 1:
You can either use an app to turn on process accounting or use command line tools:
-
App: Onyx
-
CLI:
-
Open Terminal and enter:
sudo mkdir /var/account sudo touch /var/account/acct sudo accton /var/account/acct
- With
sa
you can print the system accounting statistics. Checkman sa
-
Solution 2:
- Activity Monitor is your first item to track down CPU usage.
- Next is to get Xcode and use Instruments. That can do far deeper introspection and trace in to the system and apps.
- The deepest level is
dtrace
where you can literally pick apart system calls.
You should use these in order since the second and third need you to relax system integrity or enable a privileged helper. It's not really a huge security risk, but if you can get the accounting you need from Activity Monitor - better to keep all macOS security in place.