A collection of shell commands and scripts to safely free up disk space on macOS for developers.
Targets common heavy hitters like Docker, Xcode, VS Code, npm, Multipass, Flutter, and more.
- Prune Docker images, volumes, and build cache
- Clear Xcode DerivedData, Archives, Simulator caches
- Clean npm / yarn / pnpm caches and node_modules
- Reset Flutter / Gradle / Android SDK caches
- Purge Multipass VMs
- Wipe VS Code cache & workspaceStorage
- Remove old Homebrew artifacts
- General macOS cache cleanup
Clone the repo:
git clone https://github.com/notKeion/mac-dev-cleanup.git
cd mac-dev-cleanup
Make the script executable:
chmod +x cleanup.sh
Run the cleanup script:
./cleanup.sh
Or run with curl
directly:
curl -sSL https://raw.githubusercontent.com/notKeion/mac-dev-cleanup/main/cleanup.sh | bash
Check Docker Usage
docker system df -v
Delete old Xcode DerivedData:
rm -rf ~/Library/Developer/Xcode/DerivedData/*
Clear npm cache:
npm cache clean --force
- Review the script before running to ensure it fits your needs.
- Some commands may require elevated permissions (
sudo
). - Always back up important data before performing cleanup operations.
- The script is designed to be safe, but unintended data loss is possible.
- Use at your own risk!
Contributions are welcome! If you'd like to improve this project, please follow these steps (or just make an issue if you're unsure or lazy like me):
-
Fork the repository
Click the "Fork" button at the top-right of this page to create your own copy of the repository. -
Clone your fork
git clone https://github.com/your-username/mac-dev-cleanup.git cd mac-dev-cleanup
-
Create a new branch
git checkout -b feature/your-feature-name
-
Make your changes
Add or improve functionality, fix bugs, or update documentation. -
Test your changes
Ensure your changes work as expected and do not break existing functionality. -
Commit your changes
git add . git commit -m "Add your descriptive commit message here"
-
Push your changes
git push origin feature/your-feature-name
-
Submit a pull request
Open a pull request on the original repository and provide a clear description of your changes.
- Follow the existing code style and structure.
- Write clear and concise commit messages.
- Update documentation if your changes affect usage.
- Be respectful and constructive in discussions.
Thank you for contributing! 🎉