3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

MacOSでHomebrewをインストールしたのに 「command not found: brew」と言われた

Last updated at Posted at 2023-08-26

はじめに

「zsh: command not found: brew」 とググると色々出てくるが、そんな大それた問題じゃない。
違うんだ!インストールは成功しているんだと思っている方。

僕自身もMacOSにHomebrewをインストールしたときに地味にハマったので備忘録として。

環境

  • macOS: 13.4

事象

公式サイトより以下コマンドを実行する

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


==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

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

お!成功したっぽい・・!
以下コマンドを実行すると・・

 % brew -v
 
 zsh: command not found: brew

おおん???なんでや??成功しているやんけ??

ここで「zsh: command not found: brew」と焦って調べてみると・・
ターミナルの設定が違う?
いやいや違う違う・・そんなわけない・・

エラー文をよく読んでみると・・

==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
    (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/user/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"

「パスが通っていないので以下コマンドを実行してください」

言われたとおりに以下を実行
※ユーザーネームはご自身の名前に置き換えてください!

%  (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/ユーザーネーム/.zprofile
%  eval "$(/opt/homebrew/bin/brew shellenv)"
%  brew -v   

Homebrew 4.1.6

できた!!!!!!!!!!!!

最後に

改めてエラー文をしっかり読もうと実感した瞬間でした。
開発にも慣れてくると自分の力を過信して、細かな単純な問題に意外と苦労することあるよね・・

3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?