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 5 years have passed since last update.

M1 Mac (ARM) で Homebrew を導入する

Last updated at Posted at 2020-12-09

M1 Mac では今までの方法では、Homebrewをインストールすることができません。
基本的には下記手順を踏襲しますが、手順を細かく補足していきます。
https://docs.brew.sh/Installation

Xcode Command Line Toolsを導入する

ターミナルで下記コマンドを実行します。この手順は過去のMacと共通です。

$ xcode-select --install

仮置きで~/homebrewにインストールする

最終的には、/opt/homebrewに置きますが、いきなりおくと権限でエラーになるようなので、~/homebrewを経由します。

$ cd ~
$ mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

/opt/homebrewにコピーする

先ほどインストールしたファイルをコピーします。

$ cd /opt
$ mkdir homebrew
$ cd ~/homebrew
$ sudo cp -r . /opt/homebrew

パスを通して再読み込みする

bashではなく、zshを使うため、~/.zshenvに追記します。

$ echo export PATH="$PATH:/opt/homebrew/bin" >> ~/.zshenv
$ source ~/.zshenv

Homebrewが実行できるかを試す

下記のように表示されればHomebrewがインストールできています。

$ brew
Example usage:
  brew search [TEXT|/REGEX/]
  brew info [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]

Troubleshooting:
  brew config
  brew doctor
  brew install --verbose --debug FORMULA

Contributing:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]

Further help:
  brew commands
  brew help [COMMAND]
  man brew
  https://docs.brew.sh

追記

VirtualBoxのインストールの際に権限のエラーが出ました。
下記手順もやっておいた方が良いようです。

sudo chown -R $(whoami) /opt/homebrew
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?