'appletree' is a lightweight and efficient terminal-based directory tree viewer for macOS & Linux.
It helps you visualize folder structures with optional file filtering.
- 📂 Display a tree-like structure of directories and files
- ❌ Exclude specific files or folders (-e)
- ✅ Show only selected files or folders (-o)
- 📏 Limit recursion depth (-d)
- 🎨 Choose a theme (-t classic or -t round)
- 📦 Show file & directory sizes (-s)
- 🔧 Designed for macOS & Linux
- ⚡ Fast and lightweight
Clone the repository to your local machine:
git clone https://github.com/mattialosz/appletree.git
cd appletree- You can compile and install
appletreelocally using the providedMakefile:
make
sudo make installThe binary will be installed to /usr/local/bin/appletree by default
- To remove:
sudo make uninstallTo run without installing:
make runJust create a binary:
makeIf you prefer to compile the source code yourself, go to the folder and run:
g++ -std=c++17 -o appletree main.cppNow, you have an executable appletree that you can run.
If you are using older versions of the GCC compiler and encounter error messages related to the implementation of std::filesystem you can tell the linker about the right library by just adding a flag:
g++ -std=c++17 -o appletree main.cpp -lstdc++fsIf you prefer to run appletree only in the current directory, simply navigate to its location and execute:
./appletreeTo make appletree available as a system-wide command, move it to /usr/local/bin/:
sudo mv appletree /usr/local/bin/
sudo chmod +x /usr/local/bin/appletreeNow, you can run appletree from anywhere by simply typing:
appletree- Simply open a terminal and run:
appletree- Exclude Specific Files/Folders (example)
appletree -e node_modules(This will exclude the node_modules folder from the output.)
- Exclude Hidden Files/Folders
appletree -e .(This will automatically exclude all hidden files/folders from the output.)
- Show Only Selected Files/Folders (example)
appletree -o src include(This will display only the src and include directories.)
- Limit Tree/Recursion Depth
appletree -d 2(This will display only the first two levels of the tree.)
- Show File & Directory Sizes
appletree -s(Shows the size of each file and the total recursive size of each directory)
- Display Help
appletree help(Shows detailed usage instructions.)
You can change how the tree looks with the -t flag. Available options:
- classic (default)
- round
Change Theme/Format
appletree -t roundFor maximum efficiency, you can add an alias to your shell config (.zshrc, .bashrc, etc.). This way you don’t have to type long commands every time.
Example (zsh):
alias atr="appletree -e . __pycache__ -t round"Now you can simply type:
atr…and instantly get your customized tree view 🚀
my_project
├── src
│ ├── main.cpp
│ ├── utils.h
│ └── utils.cpp
├── include
│ └── config.h
├── README.md
└── MakefileFeel free to fork the repo, open issues, or submit pull requests! Contributions are always welcome.
- This is the first version
- Updates/optimizations will follow soon


