A GitHub Action to remove Homebrew from macOS runners to avoid conflicts.
This action removes Homebrew from GitHub-hosted macOS runners. This is useful when you need to avoid conflicts between Homebrew packages and other package managers or build systems.
Add this action to your workflow before steps that might conflict with Homebrew:
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: macos-latest
steps:
- name: Remove Homebrew
uses: xpack/remove-homebrew-action@v1
- name: Checkout code
uses: actions/checkout@v4
- name: Build project
run: ./build.sh
Use this action when:
- You're using alternative package managers (like MacPorts)
- You need a clean environment without Homebrew
- You want to avoid conflicts between Homebrew and your build system
- You need to reduce disk space usage on the runner
This action:
- Checks if the runner is macOS (skips on other platforms)
- Verifies Homebrew is installed
- Uninstalls all Homebrew packages and casks
- Removes Homebrew installation directories
- Cleans up Homebrew caches and logs
- ✅ macOS runners (macos-latest, macos-13, macos-12, etc.)
⚠️ Skips automatically on Linux and Windows runners
- This action requires
sudo
permissions (available by default on GitHub-hosted runners) - The action is idempotent - it's safe to run multiple times
- This action only removes Homebrew, not packages installed via other means
When future versions (like v1.1.0, v1.2.0, etc.) are released, update the v1 tag to point to the latest patch version:
git tag -f v1 v1.1.0
git push origin v1 -f
There is also a script, but it does not remove individual packages.
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" || true
MIT - See LICENSE for details.
Contributions are welcome! Please feel free to submit issues or pull requests.