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:
2. Next, you have to download the following “tree” source package from the link below:
You can find the link somewhere down in the landing page.
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
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.
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.