LoginSignup
2
1

More than 1 year has passed since last update.

Bazelのインストール方法(M1 mac)

Last updated at Posted at 2021-12-12

環境

記事作成日時:2021/12/12
OS: M1 mac

参考サイト

インストール手順

上記のサイトで、the binary installer [1]というのを使ってインストールします。

1. Bazel installerをダウンロード
BAZEL_VERSIONは、2021/12/12時点では4.2.2が最新です。
以下のサイトから最新版を確認してください。
https://github.com/bazelbuild/bazel/releases

以下のコードをTerminalで、入力してください。

export BAZEL_VERSION=4.2.2
curl -fLO "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-darwin-x86_64.sh"

2. Bazel installerを実行

chmod +x "bazel-${BAZEL_VERSION}-installer-darwin-x86_64.sh"
./bazel-${BAZEL_VERSION}-installer-darwin-x86_64.sh --user

実行した結果は、以下のようになると思います。

3. ~/.bashrcにPathを通す
~/.bashrcと~/.bash_profileを開いて、以下のコードを入力してください。
(*$Homeには、PCのHomeディレクリーのPathを入れてください。)

export PATH="$PATH:/$Home/bin"

bashの編集方法は下記のサイトを参考にしてください。

4. bazelが使えるか確認する。
以下のコードをtermimnalで実行して、versionが確認できれば成功です。

source ~/.bashrc
bazel --version

成功例

bazel 4.2.2

失敗例

command not found: bazel

[1]the binary installerとは

以下のサイトに説明があるので、参考にしてください。
https://jp.quora.com/sofutouea-wo-insuto-ru-suru-kiwa-no-insuto-ra-so-su-ko-do-bainari-pakke-ji-no-chigai-ha-nani-desu-ka

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