Instructions on how to install the tree
command on macOS from source.
macOS Command Line Tools need to be installed on your local computer.
To install the Command Line Tools run the following command:
xcode-select --install
To obtain the tree
source code run the following commands:
mkdir -p ~/.src/tree
curl -sL --retry 3 --insecure "http://mama.indstate.edu/users/ice/tree/src/tree-2.0.4.tgz" | tar xz --no-same-owner --strip-components=1 -C ~/.src/tree/
cd ~/.src/tree
To configure the source to be compiled for macOS run the following commands:
sed -i '.orig' -e '/SIP/,/HP/{//!s/#//;}' Makefile
To build the source code run the following command:
make
To install the tool run the following commands:
sudo make PREFIX='/usr/local' MANDIR='${PREFIX}/share/man' install
Run the following command on a terminal window:
tree --version
After installing the tool you can remove the downloaded source code using the following commands:
cd ~
rm -rf ~/.src
Many thanks!!