5
2

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 1 year has passed since last update.

M1 mac 買ったので、楽しく設定してたら Cloud SQL Proxy がいつまで経ってもインストールできなかった話

Last updated at Posted at 2021-12-22

俺を沼らせた公式

だいぶ沼ったので、備忘録です。

やったこと

1. Google Cloud SDK のインストール

brew install --cask google-cloud-sdk

公式には、別の方法でって書いてあったけど、brew がよかったので、brew install

これが全ての間違いなのかもしれないって思った

2. Cloud SQL Proxy のインストール

冒頭にもあったように公式に倣って
https://cloud.google.com/sql/docs/mysql/sql-proxy#other-os

cd ~
curl -o cloud_sql_proxy https://dl.google.com/cloudsql/cloud_sql_proxy.darwin.amd64
chmod +x cloud_sql_proxy
$ cloud_sql_proxy
zsh: command not found: cloud_sql_proxy

$ ./cloud_sql_proxy
zsh: bad CPU type in executable: ./cloud_sql_proxy

使えんことがわかった。

3. Google Cloud SDK からインストール

まず何ができるのか調べる

$ gcloud components
ERROR: (gcloud.components) Command name argument expected.

Available groups for gcloud components:

      repositories            Manage additional component repositories for
                              Trusted Tester programs.

Available commands for gcloud components:

      install                 Install one or more Cloud SDK components.
      list                    List the status of all Cloud SDK components.
      reinstall               Reinstall the Cloud SDK with the same components
                              you have now.
      remove                  Remove one or more installed components.
      restore                 Restore the Cloud SDK installation to its previous
                              state.
      update                  Update all of your installed components to the
                              latest version.

For detailed information on this command and its flags, run:
  gcloud components --help

$ gcloud components list
Your current Cloud SDK version is: 367.0.0
The latest available version is: 367.0.0

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                 Components                                                 │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬──────────┤
│     Status    │                         Name                         │            ID            │   Size   │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼──────────┤
│ Not Installed │ App Engine Go Extensions                             │ app-engine-go            │  4.1 MiB │
│ Not Installed │ Appctl                                               │ appctl                   │ 18.5 MiB │
│ Not Installed │ Cloud Bigtable Command Line Tool                     │ cbt                      │  7.5 MiB │
│ Not Installed │ Cloud Bigtable Emulator                              │ bigtable                 │  5.7 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool                      │ datalab                  │  < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator                             │ cloud-datastore-emulator │ 18.4 MiB │
│ Not Installed │ Cloud Firestore Emulator                             │ cloud-firestore-emulator │ 40.5 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator                               │ pubsub-emulator          │ 60.7 MiB │
│ Not Installed │ Cloud SQL Proxy                                      │ cloud_sql_proxy          │  7.3 MiB │
│ Not Installed │ Google Cloud Build Local Builder                     │ cloud-build-local        │  6.2 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr    │          │
│ Not Installed │ Kustomize                                            │ kustomize                │  7.4 MiB │
│ Not Installed │ Minikube                                             │ minikube                 │ 26.1 MiB │
│ Not Installed │ Nomos CLI                                            │ nomos                    │ 24.4 MiB │
│ Not Installed │ On-Demand Scanning API extraction helper             │ local-extract            │ 12.3 MiB │
│ Not Installed │ Skaffold                                             │ skaffold                 │ 17.2 MiB │
│ Not Installed │ anthos-auth                                          │ anthos-auth              │ 18.0 MiB │
│ Not Installed │ config-connector                                     │ config-connector         │ 48.9 MiB │
│ Not Installed │ gcloud Alpha Commands                                │ alpha                    │  < 1 MiB │
│ Not Installed │ gcloud Beta Commands                                 │ beta                     │  < 1 MiB │
│ Not Installed │ gcloud app Java Extensions                           │ app-engine-java          │ 51.7 MiB │
│ Not Installed │ gcloud app PHP Extensions                            │ app-engine-php           │ 21.9 MiB │
│ Not Installed │ gcloud app Python Extensions                         │ app-engine-python        │  7.8 MiB │
│ Not Installed │ gcloud app Python Extensions (Extra Libraries)       │ app-engine-python-extras │ 26.4 MiB │
│ Not Installed │ kpt                                                  │ kpt                      │ 11.7 MiB │
│ Not Installed │ kubectl                                              │ kubectl                  │  < 1 MiB │
│ Not Installed │ kubectl-oidc                                         │ kubectl-oidc             │ 18.0 MiB │
│ Not Installed │ pkg                                                  │ pkg                      │          │
│ Installed     │ BigQuery Command Line Tool                           │ bq                       │  1.0 MiB │
│ Installed     │ Cloud SDK Core Libraries                             │ core                     │ 21.5 MiB │
│ Installed     │ Cloud Storage Command Line Tool                      │ gsutil                   │  8.1 MiB │
└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴──────────┘

あった。

$ gcloud components install cloud_sql_proxy
# 略
$ cloud_sql_proxy
# 略

まとめ

よく gcloud components update って打ってたなーって思って、components ってなんやねんってのが大体解消されたので、一石二鳥でした。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?