Skip to content

xpack/remove-homebrew-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

remove-homebrew-action

A GitHub Action to remove Homebrew from macOS runners to avoid conflicts.

Overview

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.

Usage

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

When to Use This Action

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

What It Does

This action:

  1. Checks if the runner is macOS (skips on other platforms)
  2. Verifies Homebrew is installed
  3. Uninstalls all Homebrew packages and casks
  4. Removes Homebrew installation directories
  5. Cleans up Homebrew caches and logs

Platform Support

  • ✅ macOS runners (macos-latest, macos-13, macos-12, etc.)
  • ⚠️ Skips automatically on Linux and Windows runners

Notes

  • 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

Versioning

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

Alternate solutions

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

License

MIT - See LICENSE for details.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

About

A GitHun Action to remove Homebrew to avoid conflicts

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •