macos-brew
Homebrew: formulae, casks, services, taps, PATH /opt/homebrew, pin versions, bundle
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o macos-brew.zip https://jpskill.com/download/22243.zip && unzip -o macos-brew.zip && rm macos-brew.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/22243.zip -OutFile "$d\macos-brew.zip"; Expand-Archive "$d\macos-brew.zip" -DestinationPath $d -Force; ri "$d\macos-brew.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
macos-brew.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
macos-brewフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
目的
このスキルは、macOS 上での Homebrew 操作を自動化し、formulae、casks、サービス、タップ、バージョン固定を含むソフトウェアパッケージの効率的な管理を可能にします。/opt/homebrew PATH を介したパッケージのインストール、更新、システム統合といった Homebrew のコア機能に焦点を当てています。
使用する場面
このスキルは、スクリプトでの依存関係のインストール、CI/CD パイプラインでのツールの更新、開発環境の構成など、macOS のパッケージ管理タスクに使用します。GUI アプリ用の casks やカスタムリポジトリ用の taps など、Homebrew 固有の機能を扱う場合、特に自動化されたワークフローや再現可能なセットアップを確保する場合に適用します。
主な機能
- Formulae 管理: コマンドラインツール(例:
brew install wget経由)のインストール、アップグレード、削除を行います。これには、依存関係の解決やbrew pin <formula>を使用したバージョン固定が含まれます。 - Casks 処理: GUI アプリケーション(例:
brew install --cask google-chrome)を管理し、依存関係を無視したり、強制的に再インストールしたりするオプションがあります。 - サービス制御: バックグラウンドサービス(例:
brew services start postgresql)の開始、停止、再起動を行い、macOS の launchd と統合します。 - Taps 統合: 外部リポジトリ(例:
brew tap homebrew/cask)を追加し、コア以外のパッケージへのアクセスを可能にします。 - PATH と Bundle 管理: スクリプト用に /opt/homebrew を PATH に構成し、
brew bundleを使用して Brewfile からパッケージリストを管理し、再現可能な環境を実現します。 - バージョン固定: パッケージのバージョンをロックして更新を防ぎ(例:
brew pin node@14)、本番環境での安定性を確保します。
使用パターン
このスキルは、brew コマンドを直接呼び出すことで、シェルスクリプトや自動化ツールで起動します。常に which brew または command -v brew を使用して Homebrew のインストールを最初に確認してください。スクリプトによるインストールの場合、Brewfile を使用します。brew 'git' や cask 'docker' のような行を含むファイルを作成し、brew bundle --file Brewfile を実行します。AI エージェントでは、エラー処理のためにコマンドを try-catch ブロックで囲み、/opt/homebrew/bin を先頭に追加して PATH をエクスポートします。例: bash スクリプトで、パッケージをインストールして固定するには、次のようにします。
brew install node@14
brew pin node@14
別のパターン: サービスの場合、条件付きチェックと組み合わせます。例: 実行中でない場合にのみ開始する: brew services list | grep -q postgresql || brew services start postgresql。
一般的なコマンド/API
Homebrew は CLI ベースであるため、これらのコマンドをスクリプトで直接使用します。すべてのコマンドは brew <subcommand> [flags] [args] を介して実行されます。
- Formula のインストール:
brew install <formula> --forceで既存のものを上書きします。例:brew install git --force。 - Cask のインストール:
brew install --cask <cask> --no-quarantineで macOS のセキュリティプロンプトをスキップします。例:brew install --cask visual-studio-code --no-quarantine。 - パッケージの更新:
brew update && brew upgrade <formula>。固定されたバージョンをアップグレードするには--ignore-pinnedを追加します。 - Taps の管理:
brew tap <user/repo>でタップを追加します。例:brew tap homebrew/cask-fonts。 - サービスの処理:
brew services start <service>またはbrew services restart <service> --all。例:brew services stop redis。 - Bundle 操作:
brew bundle --file Brewfileでファイルからインストールします。Brewfile の形式:brew 'package'またはcask 'app'。 - バージョンの固定:
brew pin <formula>で固定し、brew unpin <formula>で解除します。例:brew pin python@3.9。 - クリーンアップ:
brew cleanup -sで古いバージョンを削除します。アップグレード後は常に実行してください。
API のような使用法では、出力をスクリプトにパイプします。例: brew list --versions | grep node でインストールされているバージョンを照会します。
統合に関する注意点
Homebrew をスクリプトに統合するには、/opt/homebrew/bin が PATH に含まれていることを確認します。.zshrc またはスクリプトに export PATH="/opt/homebrew/bin:$PATH" を追加します。CI/CD(例: GitHub Actions)では、最初に /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" で Homebrew をインストールします。認証は不要ですが、プライベートタップに拡張する場合は、export HOMEBREW_GIT_EMAIL="user@example.com" のような環境変数を使用して Git 認証情報を使用します。クロスツール統合の場合、macOS ツールと組み合わせます。例: brew install ffmpeg の後、subprocess を介して Python スクリプトで使用します。Brewfile の設定形式: brew 'jq' # JSON processor のような行を含むプレーンテキストです。複雑な操作を行う前に、常に brew --version で Homebrew のバージョンを確認してください。
エラー処理
一般的なエラーは終了コードをチェックして処理します。brew コマンドは失敗時にゼロ以外の値を返します。「formula not found」の場合、最初に brew search <formula> を使用するか、brew install <formula> 2>/dev/null || echo "Error: Formula missing" でインストールします。「Permission denied」の場合、sudo で実行するか、/opt/homebrew の所有権を修正します(例: sudo chown -R $(whoami) /opt/homebrew)。brew update 中のネットワークの問題の場合、brew update --verbose で再試行し、接続を確認します。スクリプトでは、コマンドを次のようにラップします。
if ! brew install git; then
echo "Installation failed; check logs" >&2
exit 1
fi
brew install <formula> >> install.log 2>&1 で出力をログに記録します。バージョン競合の場合、brew doctor で診断して解決します。
具体的な使用例
-
開発ツールのインストールと固定: 特定の Node.js バージョンでプロジェクトをセットアップするには、
brew install node@14の後にbrew pin node@14を実行します。これにより、バージョンが自動更新されず、一貫性が維持されます。 -
Web アプリケーションのサービス管理: Redis をバックエンドとするアプリケーションの場合、
brew services start redisでサービスを開始し、brew services list | grep redisで確認します。失敗した場合は、brew doctorで確認して再起動します。
グラフの関係
- より広範な macOS ツールについては、「macos」クラスターに接続されています。
- 「packages」タグに関連し、apt や yum スキルなどの一般的なパッケージマネージャーにリンクしています。
- 「homebrew」タグに関連付けられており、エコシステム内の高度なスクリプト作成ツールや CI ツールにリンクする可能性があります。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Purpose
This skill automates Homebrew operations on macOS, enabling efficient management of software packages, including formulae, casks, services, taps, and version pinning. It focuses on core Homebrew features to handle package installation, updates, and system integration via the /opt/homebrew PATH.
When to Use
Use this skill for macOS package management tasks, such as installing dependencies in scripts, updating tools in CI/CD pipelines, or configuring development environments. Apply it when dealing with Homebrew-specific features like casks for GUI apps or taps for custom repositories, especially in automated workflows or when ensuring reproducible setups.
Key Capabilities
- Formulae Management: Install, upgrade, or remove command-line tools (e.g., via
brew install wget), including dependency resolution and version pinning usingbrew pin <formula>. - Casks Handling: Manage GUI applications (e.g.,
brew install --cask google-chrome), with options to ignore dependencies or force reinstalls. - Services Control: Start, stop, or restart background services (e.g.,
brew services start postgresql), integrating with macOS launchd. - Taps Integration: Add external repositories (e.g.,
brew tap homebrew/cask), enabling access to non-core packages. - PATH and Bundle Management: Configure /opt/homebrew in PATH for scripts, and use
brew bundleto manage package lists from a Brewfile for reproducible environments. - Version Pinning: Lock package versions to prevent updates (e.g.,
brew pin node@14), ensuring stability in production setups.
Usage Patterns
Invoke this skill in shell scripts or automation tools by calling brew commands directly. Always check for Homebrew installation first using which brew or command -v brew. For scripted installs, use a Brewfile: create a file with lines like brew 'git' and cask 'docker', then run brew bundle --file Brewfile. In AI agents, wrap commands in try-catch blocks for error handling, and export PATH with /opt/homebrew/bin prepended. Example: In a bash script, install and pin a package like this:
brew install node@14
brew pin node@14
Another pattern: For services, combine with conditional checks, e.g., only start if not running: brew services list | grep -q postgresql || brew services start postgresql.
Common Commands/API
Homebrew is CLI-based, so use these commands directly in scripts. All commands run via brew <subcommand> [flags] [args].
- Install Formula:
brew install <formula> --forceto overwrite existing; e.g.,brew install git --force. - Install Cask:
brew install --cask <cask> --no-quarantineto skip macOS security prompts; e.g.,brew install --cask visual-studio-code --no-quarantine. - Update Packages:
brew update && brew upgrade <formula>; add--ignore-pinnedto upgrade pinned versions. - Manage Taps:
brew tap <user/repo>to add a tap; e.g.,brew tap homebrew/cask-fonts. - Handle Services:
brew services start <service>orbrew services restart <service> --all; e.g.,brew services stop redis. - Bundle Operations:
brew bundle --file Brewfileto install from a file; Brewfile format:brew 'package'orcask 'app'. - Pin Versions:
brew pin <formula>to pin;brew unpin <formula>to release; e.g.,brew pin python@3.9. - Cleanup:
brew cleanup -sto remove old versions; always run after upgrades.
For API-like usage, pipe outputs to scripts, e.g., brew list --versions | grep node to query installed versions.
Integration Notes
Integrate Homebrew into scripts by ensuring /opt/homebrew/bin is in PATH; add export PATH="/opt/homebrew/bin:$PATH" to .zshrc or scripts. In CI/CD (e.g., GitHub Actions), install Homebrew first with /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)". No authentication is required, but if extending to private taps, use Git credentials via environment variables like export HOMEBREW_GIT_EMAIL="user@example.com". For cross-tool integration, combine with macOS tools: e.g., after brew install ffmpeg, use it in Python scripts via subprocess. Config format for Brewfile: plain text with lines like brew 'jq' # JSON processor. Always verify Homebrew version with brew --version before complex operations.
Error Handling
Handle common errors by checking exit codes; brew commands return non-zero on failure. For "formula not found", use brew search <formula> first or install with brew install <formula> 2>/dev/null || echo "Error: Formula missing". If "Permission denied", run with sudo or fix ownership on /opt/homebrew (e.g., sudo chown -R $(whoami) /opt/homebrew). For network issues during brew update, retry with brew update --verbose and check connectivity. In scripts, wrap commands like:
if ! brew install git; then
echo "Installation failed; check logs" >&2
exit 1
fi
Log outputs with brew install <formula> >> install.log 2>&1. For version conflicts, use brew doctor to diagnose and resolve.
Concrete Usage Examples
-
Install and Pin a Development Tool: To set up a project with a specific Node.js version, run:
brew install node@14followed bybrew pin node@14. This ensures the version doesn't auto-update, maintaining consistency. -
Manage a Service for a Web App: For a Redis-backed app, start the service with
brew services start redis, and verify withbrew services list | grep redis. If it fails, check withbrew doctorand restart.
Graph Relationships
- Connected to "macos" cluster for broader macOS tools.
- Relates to "packages" tag, linking to general package managers like apt or yum skills.
- Associated with "homebrew" tag, potentially linking to advanced scripting or CI tools in the ecosystem.