I am trying to setup a bunch of development projects in my Mac. I have to run various tools like python, ruby, scala, groovy etc. To see if a tool is available I use options like

ruby --version. 

Instead I would like to see all the list of tools available in Mac terminal via a single command. What is the command/options for it?

  • 12
    The list will be more overwhelming than informative. On macOS 10.14.4, I see 1,302 executables in /bin, /sbin, /usr/bin, and /usr/sbin. Most of them obscure and/or single-purpose. For instance: hpftodit, which converts fonts from HP tagged font metric (TFM) format for use with an HP Laser-Jet 4-series (or newer) printer with groff -Tlj4. Ok, that's an extreme example, I claim the point is still valid. Apr 16, 2019 at 5:52

6 Answers 6


The easiest is simply to open the Terminal and then press the TAB key twice. You'll be asked if you want to see all possibilities - reply "y" and you'll get the full list.


See the answers from this U&L Q&A titled: List all commands that a shell knows .

My personal favorite is to utilize compgen since this is part of the family of tools used to build all the tab completion when you're in a terminal and hit tab> + tab twice.

$ compgen -c


$ compgen -c | tail

Incidentally, if you want to know where one of these executables lives on your HDD use type -a <cmd> to find it:

$ type -a ansible
ansible is aliased to `ANSIBLE_CONFIG=~/.ansible.cfg ansible'
ansible is /usr/local/bin/ansible

This shows that the command ansible is an alias and also lives locally on the HDD here: /usr/local/bin/ansible.



You could take the PATH variable and translate the colons into spaces then list the files in those directories.

ls  $(tr ':' ' ' <<<"$PATH")

And as Peter Cordes points out, the above will break if directory paths have spaces in their name. In a subshell, change the IFS (Internal Field Separator) to only a newline and translate the colons to newlines.

( IFS=$'\n'; ls  $(tr ':' '\n' <<<"$PATH") )  
  • 1
    If your $PATH contains spaces but not newlines, you can tr spaces to newlines inside an (IFS=$'\n'; ls $(...)) subshell so word-splitting only happens on newline. Apr 16, 2019 at 12:37

When a command is installed, an entry should have been placed in the whatis database. However, there is no requirement to do so. To get a one line description of a command in the database, enter whatis followed by the command. For example, the output from entering whatis "ruby" is shown below.

erb(1)                   - Ruby Templating
irb(1)                   - Interactive Ruby Shell
ri(1)                    - Ruby API reference front end
ruby(1)                  - Interpreted object-oriented scripting language

This the whatis command will accept regular expressions. Therefore, to get a list of all commands in the database, enter the command given below.

whatis "."

The man page for whatis states the following:

whatis searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard output. Only complete word matches are displayed.

There also exists a similar command called apropos. The man page for apropos states the following:

apropos searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard output.

Basically, the difference is apropos does not require complete word matches. For example, whatis "string" would not find a match when encountering strings, but apropos "string" would.


For completeness's sake, if you use zsh, you can use ls "${(@)path}(N)". To get a list grouped by directory, use ls "${(@)path}"/*(-*N) or printf "%s\n" "${(@)path}"/*(-*N) (unsorted but in the order they would be found); printf "%s\n" "${(@)path}"/*(-*N) | xargs -L 1 basename | sort -u will give you a list of just the commands without paths.

Do note that this only shows executables, not aliases or functions. To get those, use alias or typeset -f + | grep -v '^_' respectively.

Sample output of each:

% ls "${(@)path}"(N)
[         cat       cp
 sync      test      wait4path

apfs_hfs_convert fsck             fstyp
% ls "${(@)path}"/*(-*N)
/bin/[                                                      /usr/bin/nc                                                 /usr/local/bin/gmktemp
/bin/bash                                                   /usr/bin/ncal                                               /usr/local/bin/gmv
/bin/cat                                                    /usr/bin/ncctl                                              /usr/local/bin/gnice
/bin/chmod                                                  /usr/bin/ncdestroy                                          /usr/local/bin/gnl
/bin/cp                                                     /usr/bin/ncinit                                             /usr/local/bin/gnohup
/bin/csh                                                    /usr/bin/nclist                                             /usr/local/bin/gnproc
% printf "%s\n" "${(@)path}"/*(-*N)
% printf "%s\n" "${(@)path}"/*(-*N) | xargs -L 1 basename | sort -u

Seconding what @jksoegaard already mentioned, the simplest way is to use Tab autocompletion feature in Bash. Hitting the Tab key twice lists all available shell internal commands, external commands and alias available. If you enter the initial characters of a command, the matching commands are listed when hitting Tab key twice.

There are 3rd party package managers available for macOS which lets you install command-line-tools which are either unavailable in the native installation of macOS, or have their older version installed. A couple popular package managers among software developers are Homebrew and MacPorts.

Thus, if you are interested in the broader spectrum of developer tools available to run on your Mac, you can also list all the command-line-tools available for easy installation and running by executing brew search for Homebrew and port search for MacPorts. Executing the said commands require the respective package managers to be installed on your system.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .