Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

how do I continuously do a ps auxw on OSX?

Writer Matthew Harrington

The question is this: If I open terminal and type ps auxw, I see a list of all processes running but this command is like a snapshot of that instant. What I need is this:

I am trying to discover what process is being run by an app that is crashing just after launching. I will use the finder and double click on the app icon to execute it. For a brief moment I know the app will launch and then crash.

How do I have a terminal window monitoring the running processes all the time, so when the app launches for a brief instant, that monitoring captures the process and lists it on terminal?

How do I do that? thanks.

0

3 Answers

If you have macports available (or possibly homebrew or a similar environment) you can use watch to print the output of the command every second:

 watch -n 1 ps auxw

An alternative is to use glances, which is also available through macports.

1

You can indeed use watch for this. Alternatives are

  1. top and htop: these display processes in continuously updating windows.

  2. Use the shell

    while true; do ps auxw; sleep 1; done
  3. Use strace on Linux or ktrace on OSX.

0

I used a modified command provided by @terdon:

while true; do ps auxw >> ps.txt; date >> ps.txt; sleep 1; done

I did this to make it easier to track the processes running at a given moment.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy