A simple script to clean up and maintain your macOS system. It safely removes unnecessary files, clears caches, and optimizes system performance - all in a single command.
- macOS 15 (Sequoia) or later
- Administrator privileges
- Homebrew (optional, only for Homebrew cache cleanup)
- Clone this repository:
git clone https://github.com/adamsarba/clean-mac.git- Move to the project directory:
cd clean-mac- Make the script executable:
chmod +x CleanMac.sh- Move the script to your local bin:
sudo mv CleanMac.sh /usr/local/bin/CleanMacAdd this alias to your .zshrc or .bashrc file for easier access:
alias clean-mac="sudo CleanMac | tee ~/Desktop/cleanup_log.txt"Run the script with:
sudo CleanMacOr use the alias if configured:
clean-macThe script will:
- Create a backup of important system logs
- Prompt for optional tasks (memory purge, Spotlight reindex)
- Show disk space after cleanup
- Always creates backups before cleaning
- Asks for confirmation before risky operations
- Can be safely interrupted with Ctrl+C
- If you get "Permission denied", make sure to run with
sudo - If the script isn't found, verify it's in
/usr/local/bin - For Homebrew-related errors, ensure Homebrew is installed
-
System Cleanup
- Removes system logs and temporary files
- Clears system and application caches
- Empties trash on all volumes
-
Application Cleanup
- Cleans Adobe cache files
- Removes old iOS device backups
- Cleans Xcode derived data and archives
- Purges Homebrew cache
-
Development Tools
- Cleans up Ruby gems
- Manages Xcode-related files
- Optimizes Homebrew installations
-
System Optimization
- Optional memory purge
- Spotlight index rebuilding
- System maintenance tasks
-
Safety Features
- Creates backups before cleaning
- Respects System Integrity Protection
- Handles errors gracefully
Contributions are welcome! Before contributing:
- Check existing issues and pull requests
- Test your changes thoroughly
- Follow the existing code style
- Add comments for complex logic
This project is licensed under the MIT License - see the LICENSE file for details.
- Icon design by ©Anmol Grao
- Maintained by @Adam Sarba
If you find this tool helpful, please consider:
- ⭐ Starring the repository
- 🐛 Reporting issues
- 🔧 Contributing improvements
- 📢 Sharing with others
For questions or support:
- Open an issue on GitHub
- Follow @adamsarba for updates