The top command on OS X is pretty crappy.. The one included with most Linux distros allows you to change the sort-by column using < and >, there is a coloured mode (by pressing the z key), and a bunch of other useful options.

Is there a replacement command line tool? Ideally I would like htop for OS X, but because it relies on the /proc/ filesystem (see this thread) it has not been ported (and probably will never be)

The obvious answer is "Activity Monitor", but I'm looking for a command line tool!

link|improve this question
3  
<3 htop. +1 added for this reason. Message extended because of the stupid character requirement. – Kent Fredric May 2 '09 at 13:52
ok, I've answered the 'sort' problem - what other "useful options" are you missing? – Alnitak May 2 '09 at 16:37
3  
Note that a /proc filesystem can be made available using MacFUSE: osxbook.com/book/bonus/chapter11/procfs I don't know of any 'top' port that leverages this, however. – Sören Kuklau May 3 '09 at 18:54
1  
I'm afraid that the MacFUSE procfs is not a drop-in replacement for Linux's procfs. When I tried compiling htop (or running dstat), I was stopped because there is no /proc/stat directory. – Clinton Blackmore Jun 2 '09 at 20:15
feedback

5 Answers

up vote 14 down vote accepted

top on MacOS X does support sorting, at least:

    O<skey>        Set secondary sort key to <skey> (see o<key>).
    o<key>         Set primary sort key to <key>: [+-]{command|cpu|pid
                   |prt|reg|rprvt|rshrd|rsize|th|time|uid|username|vprvt
                   |vsize}.
link|improve this answer
feedback

I'm working on porting htop to OSX. The repo is here.

I'm currently trying to work out what to do about the licensing clash between Apple's libtop (APSL) and htop (GPL). There's probably not much more programming to do on it - but I may have to re-implement the bits of libtop I need. If anyone has suggestions on how to make the licensing work please speak up :)

link|improve this answer
Screenshot: flickr.com/photos/andyarmstrong/3651319080 – hexten Jul 2 '09 at 10:26
feedback

There is also a brew for htop if that's how you roll.

Unfortunately, Apple's /usr/bin/top continues to regress, as it no longer even understands compound single char args:

$ top -FR
invalid option or syntax: -FR
[...]

Now you must use e.g. "top -F -R -u". But, hey, Apple's "top" does not sort by cpu by default so perhaps that's the least of its worries.

link|improve this answer
feedback

htop is now part of macports -- enjoy

link|improve this answer
feedback

Top on OS X requires a little tweaking (it's not as 'blinged out' as GNU top), but it's easy to do.

On Leopard or Tiger, I use 'top -FRo [field]', where '[field]' is typically cpu, vsize, rsize, and so on. The -F and -R options will sacrifice some precision for memory calculation for a huge decrease in CPU usage by top.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.