Skip to content

DrudgeRajen/brewsweep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BrewSweep

A fast, terminal-based tool for managing your Homebrew packages by tracking their usage and helping you identify packages that can be safely removed. Built with Rust and ratatui for a responsive TUI experience.

BrewSweep License Platform

What is it?

BrewSweep scans your installed Homebrew packages (both formulas and casks) and displays them sorted by last access time. This makes it easy to identify:

  • Never-used packages - Installed but never accessed
  • Rarely-used packages - Haven't been used in months or years
  • Recently-used packages - Actively used packages to keep

The tool provides a clean, interactive interface for viewing package details and safely removing unused packages to free up disk space. Sweep away the clutter and keep only what you actually use!

Demo

Watch BrewSweep in action - scan your Homebrew packages, identify unused ones, and safely remove them:

BrewSweep Demo

BrewSweep automatically sorts packages by last access time, making cleanup decisions easy

Features

πŸ“Š Smart Package Analysis

  • Real-time scanning of all Homebrew formulas and casks
  • Last access time tracking using filesystem metadata
  • Automatic sorting by usage (least recently used first)
  • Detailed package information including installation paths

🎯 Easy Package Management

  • Interactive table view with keyboard navigation
  • Package details screen showing comprehensive information
  • Safe deletion workflow with confirmation dialogs
  • Real-time uninstall output showing brew command progress

πŸ–₯️ Terminal UI

  • Responsive interface built with ratatui
  • Color-coded display with multiple themes
  • Keyboard shortcuts for efficient navigation
  • Progress indicators for all operations

⚑ Performance

  • Fast scanning using parallel processing
  • Non-blocking UI - responsive during operations
  • Memory efficient handling of large package lists
  • Background operations for deletions

Installation

Prerequisites

Using Cargo (Recommended)

cargo install brewsweep

From Source

# Clone the repository
git clone https://github.com/DrudgeRajen/brewsweep.git
cd brewsweep

# Build and install
cargo build --release

# Run the application
./target/release/brewsweep

Using Cargo from Git

# Install directly from git
cargo install --git https://github.com/DrudgeRajen/brewsweep.git

Usage

Basic Workflow

  1. Start the application

    brewsweep
  2. Scan packages

    • Press Space to start scanning your Homebrew installation
    • Watch real-time progress as packages are discovered
  3. Browse packages

    • Use ↑/↓ arrow keys to navigate the package list
    • Packages are automatically sorted with least-used first
  4. View details

    • Press Enter on any package to see detailed information
    • View last access time, type, and installation path
  5. Delete packages

    • Press d to delete a selected package
    • Confirm with y or cancel with n
    • Watch real-time output from the brew uninstall command

Keyboard Controls

Main Table

Key Action
Space Start package scan
↑/↓ Navigate up/down
←/β†’ Navigate left/right
Enter View package details
d Delete selected package
r Refresh (re-scan packages)
Shift + β†’ Next color theme
Shift + ← Previous color theme
Esc Quit application

Package Details

Key Action
Enter/Space Back to table
d Delete this package
Esc Quit application

Deletion Confirmation

Key Action
y/Enter Confirm deletion
n/Space Cancel deletion
Esc Quit application

Package Information Display

The tool displays packages with the following information:

  • Package Name - The Homebrew package identifier
  • Type - Formula (command-line tool) or Cask (GUI application)
  • Last Accessed - Human-readable time since last use:
    • "Never accessed" - Package never used
    • "2 hours ago" - Recently used
    • "3 months ago" - Moderately old
    • "1 year ago" - Very old, candidate for removal
  • Path - Installation location on your system

Sorting Logic

Packages are automatically sorted by usage to prioritize cleanup candidates:

  1. Never accessed packages (top of list)

    • Easiest to identify for removal
    • Safe to delete if you don't recognize them
  2. Oldest accessed packages

    • Haven't been used in months/years
    • Good candidates for cleanup
  3. Recently accessed packages (bottom of list)

    • Actively used, probably should keep
    • Latest access times

Development

Building from Source

git clone https://github.com/DrudgeRajen/brewsweep.git
cd brewsweep
cargo build --release

Dependencies

This project uses the following Rust crates:

  • ratatui - Terminal user interface
  • crossterm - Cross-platform terminal handling
  • color-eyre - Error handling and reporting
  • unicode-width - Text width calculation

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

Development Setup

git clone https://github.com/DrudgeRajen/brewsweep.git
cd brewsweep
cargo build
cargo run

Running Tests

cargo test

Code Style

This project uses standard Rust formatting:

cargo fmt
cargo clippy

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with ratatui for the excellent terminal UI framework
  • Uses crossterm for cross-platform terminal support
  • Error handling powered by color-eyre
  • Inspired by the need to manage ever-growing Homebrew installations efficiently

Support

If you find this tool useful, please consider:

  • ⭐ Starring the repository
  • πŸ› Reporting bugs and issues
  • πŸ’‘ Suggesting new features
  • 🀝 Contributing code improvements

Happy Homebrew sweeping! 🧹✨

Keep your system lean and your packages meaningful.

About

πŸ› οΈ [WiP] A tool to track and manage homebrew packages based on usage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages