LoginSignup
28
25

More than 3 years have passed since last update.

M1 macにhomebrewをいれる

Posted at

概要

Homebrewがversion2.6でm1 macに対応しましたね!👏

Today I’d like to announce Homebrew 2.6.0. The most significant changes since 2.5.0 are macOS Big Sur support on Intel, brew commands replacing all brew cask commands, the beginnings of macOS M1/Apple Silicon/ARM support and API deprecations.
https://brew.sh/2020/12/01/homebrew-2.6.0/

ARM版はまだ完全版じゃないため、Intel版(Rosetta使用)と並行して使えるように、 /opt/homebrew にインストールするようにとのこと

macOS Homebrew running natively on M1/Apple Silicon/ARM has partial functionality. We recommend installing into /opt/homebrew and forbid installing into /usr/local (to avoid clashing with the macOS Intel install and allow their usage side-by-side). We currently recommend running Homebrew using Intel emulation with Rosetta 2.

実行環境

Big Sur 11.0.1
MacBook Pro (13-inch, M1, 2020)

インストール方法

ここを参考にインストールします。
先述通り /opt/homebrew に置くようにとのことなので、まずはディレクトリ作成から


sudo mkdir /opt/homebrew
sudo chown -R $(whoami) /opt/homebrew
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C /opt/homebrew

PATHを通す

macのデフォルトシェルがzshになっているためzshrcに入れました


touch ~/.zshrc
echo 'export PATH=$PATH:/opt/homebrew/bin' >> ~/.zshrc
source ~/.zshrc

インストールできてるか確認


which brew
/opt/homebrew/bin/brew

brew --version
Homebrew >=2.5.0 (shallow or no git repository)
Homebrew/homebrew-core N/A

version上げ

2.5になってたのでバージョンを上げます


brew update
brew --version
Homebrew 2.6.0-104-g24f7898
Homebrew/homebrew-core (git revision 694814; last commit 2020-12-07)

動作確認

ちゃんとarm版がインストールされました🎉


brew install jq

file /opt/homebrew/bin/jq
/opt/homebrew/bin/jq: Mach-O 64-bit executable arm64

echo '{"mac":[{"id":1,"name":"intel"},{"id":2,"name":"arm"}]}' | jq .
{
  "mac": [
    {
      "id": 1,
      "name": "intel"
    },
    {
      "id": 2,
      "name": "arm"
    }
  ]
}
28
25
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
28
25