LoginSignup
5
4

More than 3 years have passed since last update.

Homebrewのインストール方法について

Last updated at Posted at 2019-08-21

はじめに

macOSのパッケージ管理システムである、Homebrewのインストール方法について、投稿します。
※エラーの対処法については、後半で触れています。

インストール方法

ターミナルを起動し、以下のコマンドを入力します。
※コマンドはHomebrewの公式サイトからコピペ

ターミナル
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

(省略)

Press RETURN to continue or any other key to abort
==> 
Password:

(省略)

途中の「Press RETURN〜」でEnterを押し、password:でOSのパスワードを入力すればOKです。
※パスワードは入力しても文字が表示されませんが、そのまま入力しEnterを押せば大丈夫です。

以上で、Homebrewのインストールは完了です。
最後に、正しくインストールされているか、以下のコマンドで確認します。

ターミナル
$ brew doctor
Your system is ready to brew.

このように、「Your system is ready to brew.」と表示されたら、無事にインストールが完了です。

なお、自分の場合、以下のようなエラーが発生したため、対処法についても記しておきます。

エラー内容

ターミナル
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /Users/name/.pyenv/shims/python3.6m-config
  /Users/name/.pyenv/shims/python-config
  /Users/name/.pyenv/shims/python3-config
  /Users/name/.pyenv/shims/python3.6-config

これは、PATH環境変数に、pyenvのディレクトリが含まれてしまっていることが原因で、エラーが起こっています。そのため、以下のコマンドを入力し、Homebrewを実行するときはPATH環境変数に、pyenvのディレクトリを含まないようにします。

ターミナル
$ alias brew="PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin brew"

再度「$ brew doctor」を実行し、「Your system is ready to brew.」が表示されればOKです。

参考サイト

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