LoginSignup
14
10

More than 5 years have passed since last update.

Macにgoogle-cloud-sdk(gcloudコマンド)をインストール

Last updated at Posted at 2018-10-07

概要

手元のMacBook Pro(High Sierra)にgoogle-cloud-sdkをインストールする。
gcloudコマンドを使用するため。

手順

ダウンロード

ここを参考に。
https://cloud.google.com/sdk/docs/quickstart-mac-os-x?hl=ja

パッケージを展開

$ tar xvzf /path/to/tarball -C /path/to/install_dir

インストール

$ cd /path/to/install_dir
$ ./google-cloud-sdk/install.sh

シェルの設定

install.shの実行時にメッセージが出るが、それをシェルの初期化時に行われるようにする。
これが適切な設定か分からないが動く。

~/.bash_profile
source /path/to/install_dir/google-cloud-sdk/completion.bash.inc
source /path/to/install_dir/google-cloud-sdk/path.bash.inc

設定後、ログインし直すか、上記のコマンドを手動で実行しておく。(次の手順で必要)

初期設定

$ gcloud init

先ほどの設定でgcloudコマンドへのパスが通ったはず。
初期設定でいくつか選択項目があるが、後で変えられるので悩む必要はない。

バージョン更新

古いバージョンがインストールされているので、最新バージョンにアップデートする。

$ gcloud components update

確認など

# インストールされているgoogle-cloud-sdkの情報
$ gcloud info

# 設定の情報
$ gcloud config list

使い方

適当な場所でhelpとか-hとかすると、だいたい教えてくれる。

gcloud help
gcloud -h
gcloud --help

以上です。

14
10
3

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
14
10