Your CLI junk drawer, finally cleaned up.
clenv is a terminal tool that scans your system for forgotten CLI tools installed via brew, npm, pip, pipx, cargo, gem, go, apt and more β then lets you cleanly remove them (binaries and leftover config files) through a slick interactive TUI.
And yes, when you're done, it offers to uninstall itself too.
As developers, our terminal is our second home. Over time, we install dozens of CLI tools and utilities to solve immediate problemsβa quick formatter here, an API client there, an experimental utility somewhere else.
While it is easy to clean up desktop applications (they sit visibly in our Applications folder or Start Menu, prompting us to uninstall them when they are no longer needed), CLI tools are invisible. They hide away in global npm, pip, cargo, gem, or brew paths, quietly consuming disk space and cluttering our shell environment long after we have forgotten they even exist.
clenv was built to solve this exact problem:
- Find the Forgotten: It aggregates and scans your package managers and system directories to surface every globally-installed CLI tool in one unified view.
- Track Utility: It analyzes your shell history to show you which commands you actually use versus which ones have been sitting idle for months.
- Clean the Leftovers: It removes not just the binary, but the configurations, cache files, and hidden directories (
~/.config/tool,~/.cache/tool) that standard package managers leave behind.
| Feature | Details |
|---|---|
| π Cross-manager scan | brew Β· npm -g Β· pip Β· pipx Β· cargo Β· gem Β· go Β· apt/dpkg |
| π Last-used detection | Checks shell history to show which tools you actually use |
| π Config cleanup | Removes ~/.config/tool, ~/.cache/tool, dotfiles |
| βοΈ Interactive TUI | Multi-select with keyboard navigation |
| πͺ Self-uninstall | Removes itself on exit β zero hypocrisy |
| π Single language | Pure Python, no compilation needed |
Choose the installation method for your operating system:
You can install clenv with a single command using our shell script:
curl -fsSL https://raw.githubusercontent.com/AnasNafees1802/clenv/main/install.sh | bashAlternatively, you can install it via Python:
# via pipx (recommended β keeps it isolated)
pipx install git+https://github.com/AnasNafees1802/clenv.git
# via pip
pip install git+https://github.com/AnasNafees1802/clenv.gitSince Windows does not natively run bash scripts, install clenv directly using your Python environment:
# via pipx (recommended β keeps it isolated)
pipx install git+https://github.com/AnasNafees1802/clenv.git
# via pip
pip install git+https://github.com/AnasNafees1802/clenv.gitNote: Make sure your Python Scripts directory (e.g., %USERPROFILE%\AppData\Local\Programs\Python\Python3xx\Scripts) is in your system's PATH environment variable.
If you just want to run clenv once to clean your system without a permanent installation:
pipx run --spec git+https://github.com/AnasNafees1802/clenv.git clenvclenv
That's it. The TUI guides you through everything:
- Scan β detects all CLI tools across package managers
- Review β see tool name, source, version, and whether you've used it recently
- Select β checkbox-select the tools you want to remove
- Remove β clenv runs the right uninstall command per tool and cleans up configs
- Exit β clenv offers to remove itself, then says goodbye
| Manager | How detected |
|---|---|
| Homebrew | brew list --formula |
| npm | npm list -g --depth=0 |
| pipx | pipx list --json |
| pip | pip list --format=json + binary check |
| Cargo | ~/.cargo/bin/ + .crates2.json |
| RubyGems | gem list + binary check |
| Go | $GOPATH/bin/ |
| APT/dpkg | dpkg -l + binary check |
- Nothing is deleted without confirmation. You review a list and explicitly confirm before anything is removed.
- Dry-run friendly. The table view shows you everything without making any changes.
- Config removal is optional. You're asked separately whether to remove leftover config/cache files.
- Self-uninstall is always opt-in. clenv asks at the end; you can always say no.
- Python 3.9+
- Works on macOS and Linux
- Windows support via WSL
PRs welcome! Areas to improve:
- Windows native support (choco, winget, scoop)
--dry-run/--jsonoutput flags- Fish/Nushell history parsing
dnf/yumscanner for RHEL-based systems
Anas Nafees
π LinkedIn Profile
MIT β see LICENSE