Hacker News new | past | comments | ask | show | jobs | submit login

Semi-related fun fact: if you open Activity Monitor with sudo from the command line, you get a lot more metrics and knobs to turn.



How exactly do you do this? When I try sudo <binary path> it immediately sigkills with a "launch constraint violation". And I tried on 10.8 from back before SIP was a thing, and didn't see any difference in terms of the per-process metrics I could sort by.


This works for me (macOS 13.5):

    sudo '/System/Applications/Utilities/Activity Monitor.app/Contents/MacOS/Activity Monitor'
But it's certainly possible that I'm forgetting about some protection I had to disable to make it work.

According to my notes, the reason I saved this command is because it let me see the list of open files and ports. But I'm actually not seeing those when running it now...


You can get open files and ports even without sudo for non-root processes by just hitting cmd+i. Maybe running with sudo might allow you to sample or get files for processes owned by root (presumably the info is same as what you'd get with lsof though). (And by ports it seems to mean network ports. If you want mach ports, you can use lsmp).


That doesn't work on MacOS 14. It fails with a code signing violation. You need to use open(1) for app bundles.


Ye, quite a few apps don't function correctly if you run the executable directly.

  sudo open /System/Applications/Utilities/Activity\ Monitor.app


or

    sudo open -a Activity\ Monitor


Launch an app bundle with open(1).




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: