How do I use "tree" in Mac OS X ?

How Do I Use Directory Listing for My Mac OS X or Linux ?

If you are used to DOS operating system environment and used “cmd” console before, you probably know about “tree” command. It is a very nice command where you can see the tree like structure in your console window. While the command would be very useful in Mac OS X, where the Terminal application comes as a default, the feature does not come with the operating system. Here, I am going to show you the step to how you can install the “tree” equivalent tool for Mac OS X. These steps should also work for a Linux operating system.

1. First you need to have XCode command line tool installed. If you have not, open a Terminal window and type in the following command:

xcode-select --install

2. Next, you have to download the following “tree” source package from the link below:

http://mama.indstate.edu/users/ice/tree/

You can find the link somewhere down in the landing page.

Download that tar.gz file
Download that tar.gz file

3. Go to the directory with your Terminal (e.g. cd ~/Downloads) and untar the file using the following command:

tar xvzf tree-x.x.x.tgz

Untar the tree package
Untar the tree package with “tar xvzf”

Replace the file name tree-x.x.x.tgz with an appropriate version name.

4. Once you untar the file, go to the untarred directory (e.g. cd ~/Downloads/tree-x.x.x) and open “Makefile” file with your text editor and locate the block that refers to the Mac OS.

Uncomment the lines by removing # characters for Mac OS. If you are using Linux, it works in the same way.

Uncomment the lines inside Makefile
Uncomment the lines inside Makefile

Save the file.

5. Last step! Run the following command to install the tree package.

sudo make install

6. You are done! Now check the result by typing “tree” in your Terminal window.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s