Files
brewfile-tool/README.md
T
2026-07-15 08:10:21 +09:00

72 lines
2.8 KiB
Markdown

# Brewfile Tool
A tool to manage Homebrew packages from a CSV file.
## Features
- Generate a Brewfile from a CSV list of packages.
- Install packages via the Brewfile, automatically resolving required dependencies.
- Check installation status and clean up packages not listed in the Brewfile.
## Requirements
- macOS
- [Homebrew](https://brew.sh)
- Python 3
## CSV Format
Packages are defined in `apps.csv`. Each row describes one package.
![csv_edit](/assets/csv_edit.png)
### Columns
| Column | Required | Type | Description |
| ---------------- | -------- | ------ | ------------------------------------------------------------ |
| name | Yes | string | Exact package name used by the installer. |
| type | Yes | enum | One of `formula`, `cask`, `mas`, `vscode`, or `manual`. |
| mas_id | No | string | Mac App Store app ID. Required only when `type` is `mas`. |
| install_on_setup | Yes | bool | `yes` to include the package in the Brewfile, otherwise `no`.|
| description | No | string | Short note about the package, written as a Brewfile comment. |
* Rows with a `type` of `manual` are ignored during generation.
Thus, setting `install_on_setup` with `manual` type doesn't have any effect.
* This tool only reads and uses 5 columns stated in this table.
It is free to make more columns to add more metadata for packages.
### Types
| Type | Brewfile Entry | Dependency |
| ------- | ------------------------- | ----------------------------- |
| formula | `brew "..."` | none |
| cask | `cask "..."` | none |
| mas | `mas "...", id: ...` | `mas` (install if missing) |
| vscode | `vscode "..."` | `code` (install if missing) |
## Usage
Run the tool and select an option from the menu.
```
python3 brewfile_tool.py
╰─➤ Select option
1) Create Brewfile
2) Install packages
3) Check packages
4) Cleanup packages
5) Exit
option:
```
| Option | Description |
| --------------- | ------------------------------------------------------------------- |
| Create Brewfile | Generate a Brewfile from `apps.csv`. The old Brewfile is automatically backed up. |
| Install packages| Install dependencies if needed, then run `brew bundle install`. |
| Check packages | Verify that every package in the Brewfile is installed. |
| Cleanup packages| Remove installed packages that are not listed in the Brewfile. |
| Exit | Quit the tool. |