Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the GNU utils, ps auxf gives the process list with forest (tree). Is there a equivalent for this command at BSD / OS X systems?

share|improve this question
Is it desperately important that you use a command line version of it? If you just want to see the tree, why not use "Activity Monitor" and choose "All Processes, Hierarchically"? – AlanGBaker Oct 28 '11 at 22:45
up vote 5 down vote accepted

pstree is generally part of the default install or easily installable on bsd systems. That's what I use. For example, you can install it via macports on a mac.

share|improve this answer
Too bad that ps doesn't have this ability, but I'll manage myself with pstree. Thanks for mentioning it! – vdboor Oct 31 '11 at 14:37
or brew install pstree with hombrew – cwd Mar 29 '15 at 13:28

Htop is also a really good process viewer, and it has "tree" view as one of it's main options in the lower status bar (F5).

enter image description here

share|improve this answer

If you really love GNU ps, you can install it onto OSX via one of the big 3 package systems:

pkgsrc (NetBSD) -- my favorite since it works on most popular Unixes

MacPorts (OSX)

Fink (Debian, but does not share the packageset, and of course does not share the builds)

share|improve this answer
What's the package called? MacPorts is what I'm looking for, but it'd be helpful for others to know all three. – Jim Stewart Nov 20 '13 at 22:25
-1 - seems somewhat incorrect. if it is right, please support your answer with more details on how to install using these package systems rather than just mentioning the package management systems (esp. MacPorts ) – cwd Mar 29 '15 at 13:41

So far I don't believe OSX has a built in that does this.

But here's an answer I posted on stackexchange as well; a small perl script that determines the process hierarchy and prints it in an indented form using the output of OSX's built-in ps(1).

Tested on OSX 10.6 and 10.9, and should work on linux as well (Sci Linux 6).

# treeps -- show ps(1) as process hierarchy -- v1.0 07/08/14
my %p;                    # Global array of pid info
sub PrintLineage($$) {    # Print proc lineage
  my ($pid, $indent) = @_;
  printf("%s |_ %-8d %s\n", $indent, $pid, $p{$pid}{cmd});  # print
  foreach my $kpid (sort {$a<=>$b} @{ $p{$pid}{kids} } ) {  # loop thru kids
    PrintLineage($kpid, "   $indent");                       # Recurse into kids
open(FD, "ps axo ppid,pid,command|");
while ( <FD> ) { # Read lines of output
  my ($ppid,$pid,$cmd) = ( $_ =~ m/(\S+)\s+(\S+)\s(.*)/ ); # parse ps(1) lines
  $p{$pid}{cmd} = $cmd;
  $p{$pid}{kids} = ();
  push(@{ $p{$ppid}{kids} }, $pid); # Add our pid to parent's kid
PrintLineage(1, "");     # recurse to print lineage starting with pid 1
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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