LoginSignup
4
2

More than 1 year has passed since last update.

Macでbrewコマンドのパスを通す方法

Last updated at Posted at 2022-01-28

概要

MacでHomebrewをインストールし
brewコマンドのパスを通す

↓Homebrew公式サイト
https://brew.sh/index_ja

手順

1.ターミナルを開く

2.下記のコマンドを実行

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

3.パスワードを入力します

==> Checking for `sudo` access (which may request your password)...
Password:

インストールが実行されていきます

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

4.RETURNキーを押下します

Press RETURN to continue or any other key to abort:
==> /usr/bin/sudo /usr/sbin/chown -R (username):admin /opt/homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 1221, done.
remote: Counting objects: 100% (664/664), done.
remote: Compressing objects: 100% (92/92), done.
remote: Total 1221 (delta 578), reused 638 (delta 560), pack-reused 557
Receiving objects: 100% (1221/1221), 363.62 KiB | 1.10 MiB/s, done.
Resolving deltas: 100% (789/789), completed with 113 local objects.
From https://github.com/Homebrew/brew
 * [new branch]          dependabot/bundler/Library/Homebrew/sorbet-0.5.9566 -> origin/dependabot/bundler/Library/Homebrew/sorbet-0.5.9566
   385892f3d..05b5a2c49  master     -> origin/master
 * [new tag]             3.3.10     -> 3.3.10
 * [new tag]             3.3.11     -> 3.3.11
 * [new tag]             3.3.12     -> 3.3.12
HEAD is now at 05b5a2c49 Merge pull request #12793 from Homebrew/dependabot/bundler/Library/Homebrew/rbi-0.0.10

Updated 1 tap (homebrew/core).
Warning: /opt/homebrew/bin is not in your PATH.
  Instructions on how to configure your shell for Homebrew
  can be found in the 'Next steps' section below.
==> 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 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/(username)/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

5.下記を実行

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/(username)/.zprofile

(username)の箇所は、お使いのPCに応じて変換してください
コピーするコマンドは、手順4の最後の方に
"Run these two commands in your terminal to add Homebrew to your PATH:"
の下にあるコマンドをコピーして実行してください

6.下記を実行

eval "$(/opt/homebrew/bin/brew shellenv)"

最後に

手順の5、6の補足です
4のコマンド実行時の最後に

Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:

上記が出力されています。
「次のステップとして、
ターミナルで2つのコマンドを実行して、HomebrewをPATHに追加する」
という意味なので、
手順5、6を実行してbrewコマンドのPATHを通しています。

下記を実行してインストールされていることを確認します

(username)noMacBook-Air ~ % brew -v
Homebrew 3.3.12
Homebrew/homebrew-core (git revision a0e81be5dbf; last commit 2022-01-28)

参考サイト

4
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
4
2