LoginSignup
1
2

More than 1 year has passed since last update.

MacでのHomeBrewのインストールのメモ

Last updated at Posted at 2022-07-08

はじめに

タイトルに書いたように、MacにHomeBrewをインストールを試みたところしょぼいミスをしたので忘れないようにメモ。

インストール方法

まずは当方の環境。

  • OS : macOS Monterey(ver 12.2.1) ※Mac mini(M1 2020)
  • チップ : Apple M1
  • メモリ : 8GB

インストール方法については、公式サイトを確認する。
https://brew.sh/index_ja

Macのターミナル上で、以下のコマンドを実行すれば良い。

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

コマンドを実行すると、インストール状況がターミナル上に出力される。
途中でキーボード操作が必要となる箇所があるため★で補足。

==> Checking for `sudo` access (which may request your password)...
Password: ★★sudoで実行するためMacのユーザパスワードを入力。★★
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew

Press RETURN/ENTER to continue or any other key to abort: ★★エンターキーを入力。★★
==> /usr/bin/sudo /usr/sbin/chown -R ****:**** /opt/homebrew
==> Downloading and installing Homebrew...

※※ 途中は省略 ※※

==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ユーザ名/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

Installation successful!
が出力されているので、インストールは無事成功している(ハズ)と思い、以下のコマンドを実行してHomeBrewのバージョンを確認。

% brew -v
zsh: command not found: brew

はい、動きませんね(;´Д`)
エラーの内容的にPATHが設定されていないか、そもそもインストールが失敗しているか、というところと思います。
改めて先程のターミナル上のログを参照してみると、、

- Run these two commands in your terminal to add Homebrew to your PATH:
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ユーザ名/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started

実行すべきコマンドが不足してますね・・・
以下のコマンドを実行(ユーザ名は各環境で違うと思うので、適宜修正)

% echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ユーザ名/.zprofile
% eval "$(/opt/homebrew/bin/brew shellenv)"

この状態でまたコマンドを実行すると、

% brew -v   
Homebrew 3.5.4
Homebrew/homebrew-core (git revision f85ce66fab3; last commit 2022-07-07)

バージョンが表示されたので正常にインストールされていることが確認できました。

最後に

インストール時には、ターミナルに出力されているメッセージはきちんと読みましょう・・・

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2