Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/narekmosisian/mac-storage-manager
https://github.com/narekmosisian/mac-storage-manager
application-management automation bash cli cli-tool disk-cleaner disk-cleanup disk-usage homebrew macos open-source parallel-processing performance shell-script utility zsh zshscript
Last synced: 15 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/narekmosisian/mac-storage-manager
- Owner: NarekMosisian
- License: mit
- Created: 2024-09-26T11:53:23.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-12-08T19:16:24.000Z (16 days ago)
- Last Synced: 2024-12-08T20:24:25.934Z (16 days ago)
- Topics: application-management, automation, bash, cli, cli-tool, disk-cleaner, disk-cleanup, disk-usage, homebrew, macos, open-source, parallel-processing, performance, shell-script, utility, zsh, zshscript
- Language: Shell
- Homepage:
- Size: 1.73 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mac Storage Manager
The Mac Storage Manager is a shell script designed to help you manage disk space by identifying large applications on your Mac. It allows you to see the size of various installed applications, including Homebrew packages, and interactively select which ones to delete. It also provides options to delete associated caches and configuration files to free up additional space.
## Features
- **Size Calculation**: The script calculates the size of:
- Homebrew formulas (installed via `brew list --formula`)
- Homebrew casks (installed via `brew list --cask`)
- Applications in `/Applications` and `~/Applications` directories
- Optionally, applications found across the entire system via `sudo find`![Sudo Find Prompt](./images/screenshot_sudo_find.png)
- **Interactive Deletion**: After collecting the application sizes, the script allows you to interactively select applications for deletion using a graphical dialog (`whiptail`).
- **Selective Deletion**: The script prompts you for each category of associated files (Application Support, Preferences, Caches, Logs, Saved Application State) whether you want to delete them.
- **Comprehensive Removal**: The script not only deletes the main application files but also associated files, including:
- **Homebrew Files**:
- Uninstalls associated Homebrew formulas and casks.
- **Application Support files** (optional)
- **Preferences** (optional)
- **Caches** (optional)
- **Logs** (optional)
- **Saved Application State** (optional)
- **Other files matching the application name found via `sudo find`** (optional)- **User Confirmation**: Before deleting any files, the script prompts for confirmation, displaying exactly which files and directories will be removed.
- **Progress Bar and Sound Effects**: The script displays a progress bar during long-running tasks and provides audio feedback for key actions (e.g., when interacting with the GUI).
- **Logging**: The script creates a log file `application_size_checker.log` where errors and warnings are recorded. Check this file if you encounter issues during execution.
![main](./images/screenshot_main.png)
## Watch the Demo
> **Tip:** Hold down Ctrl (Windows/Linux) or Cmd (Mac) and click the image to open the video in a new tab.
Click the image to watch the demo video on YouTube.
## How to Use
### Step 1: Clone the Repository
Clone this repository to your local machine using:
```bash
git clone https://github.com/NarekMosisian/mac-storage-manager.git
```### Step 2: Make the Script Executable
Navigate to the cloned directory and make the script executable by running:
```bash
chmod +x ./application_size_checker.sh
```### Step 3: Install Dependencies
The script relies on several tools. Install them via Homebrew:
```bash
brew install jq newt
```jq: Parses JSON output from system commands.
newt: Provides terminal-based GUI dialogs (for interactive selection and progress bars).### Step 4: Run the Script
Run the script with the following command:
```bash
./application_size_checker.sh
```Note: The script uses zsh. Ensure that zsh is installed and set as your default shell, or run the script explicitly with zsh:
```bash
zsh ./application_size_checker.sh
```### Step 5: Follow the Interactive Prompt
During the script's execution, you will be prompted with the following option:
Include sudo find: This step searches for all applications across the system but may take a long time to complete.
Once the script has gathered the sizes of all applications, a graphical interface will appear, allowing you to select the applications you wish to delete. After selection, the script will:
Prompt for confirmation before deleting each application and its associated files.
Display the list of files and directories that will be removed for each application.
Prompt you for each category of associated files (Application Support, Preferences, Caches, Logs, Saved Application State) whether you want to delete them.
Optionally delete any additional files found via sudo find that are associated with the application.## Known Limitations and Common Issues
- **Performance**: Searching the entire system with sudo find can be very time-consuming and may strain system resources.
- **Permissions**: Ensure you have the necessary permissions to uninstall applications and delete files.
- **Security Warning**: Be cautious when deleting applications and files to avoid data loss.
- **Shell Compatibility**: The script is written for zsh. Ensure you have zsh installed.## Dependencies
This script relies on the following tools:
- **jq**: A lightweight and flexible command-line JSON processor.
- **Homebrew**: A package manager for macOS.
- **whiptail**: A package for creating GUI dialogs in the terminal.Make sure these dependencies are installed before running the script.
## What Exactly is Deleted
When you confirm the deletion of an application, the script attempts to thoroughly remove it by deleting:
- **Main Application Files**: The application bundle from `/Applications` and `~/Applications`.
- **Homebrew Files**:
- Uninstalls associated Homebrew formulas and casks installed via Homebrew.- **Associated Files and Directories**:
- **Application Support** (optional):
- `~/Library/Application Support/`
- `/Library/Application Support/`
- **Preferences** (optional):
- `~/Library/Preferences/com..*`
- `/Library/Preferences/com..*`
- **Caches** (optional):
- `~/Library/Caches/`
- `~/Library/Caches/com..*`
- `/Library/Caches/`
- `/Library/Caches/com..*`
- **Logs** (optional):
- `~/Library/Logs/`
- `/Library/Logs/`
- **Saved Application State** (optional):
- `~/Library/Saved Application State/com..*`
- `/Library/Saved Application State/com..*`- **Additional Files Found via `sudo find` (optional)**: Any files matching the application name found during the `sudo find` operation (if you chose to include this step). The script will display these files and ask for your confirmation before deletion.
## Log File
The script creates a log file `application_size_checker.log` where errors and warnings are recorded. Check this file if you encounter issues during execution.
## Warning
Please read the following carefully before using the script:
- **Data Loss Risk**: The script performs a thorough deletion of applications and their associated files. Be cautious when selecting applications to delete. Ensure that you do not remove essential system applications or files.
- **Review Before Deleting**: Before any files are deleted, the script will display a list of files and directories that will be removed. Please review this list carefully to avoid unintended deletions.
- **No Undo**: Deleting applications and files is permanent and cannot be undone. Consider backing up important data before proceeding.
- **Use at Your Own Risk**: The script is provided "as is," without warranty of any kind. The author is not responsible for any damage or data loss that may occur as a result of using this script.## Connect with me
If you have any questions or want to discuss the project further, feel free to connect with me on [LinkedIn](https://www.linkedin.com/in/narek-mosisian-484789291/).
## License
This project is licensed under the **GNU Affero General Public License v3.0 (AGPLv3)**.
This license ensures that anyone who modifies, uses, or redistributes this software—especially in a networked environment—must share the source code and any modifications under the same license.For detailed information, see the [LICENSE](./LICENSE) file.