0
0

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.

macの買い替えとともにgoの再インストール

Last updated at Posted at 2021-11-16

SHELLの確認

macOSがCatalina以後はデフォルトシェルが「zsh」に変わる

Catalina以前

$ echo $SHELL
/bin/bash

Catalina以後

$ echo $SHELL
/bin/zsh

goenv/INSTALL.mdの手順通りにコマンド実行

$ git clone https://github.com/syndbg/goenv.git ~/.goenv

~/.zshrcに追記

vi とかで適当に開いて下記を追記

export GOENV_ROOT=$HOME/.goenv
export PATH=$GOENV_ROOT/bin:$PATH
eval "$(goenv init -)"

インストール出来るGoのバージョンを確認

$ goenv install -l
Available versions:
  1.2.2
  1.3.0
  1.3.1
  1.3.2
  1.3.3
  1.4.0
  1.4.1
  1.4.2
  1.4.3
  1.5.0
  1.5.1
  1.5.2
  1.5.3
  1.5.4
  1.6.0
  1.6.1
  1.6.2
  1.6.3
  1.6.4
  1.7.0
  1.7.1
  1.7.3
  1.7.4
  1.7.5
  1.8.0
  1.8.1
  1.8.3
  1.8.4
  1.8.5
  1.8.7
  1.9.0
  1.9.1
  1.9.2
  1.9.3
  1.9.4
  1.9.5
  1.9.6
  1.9.7
  1.10.0
  1.10beta2
  1.10rc1
  1.10rc2
  1.10.1
  1.10.2
  1.10.3
  1.10.4
  1.10.5
  1.10.6
  1.10.7
  1.10.8
  1.11.0
  1.11beta2
  1.11beta3
  1.11rc1
  1.11rc2
  1.11.1
  1.11.2
  1.11.3
  1.11.4
  1.11.5
  1.11.6
  1.11.7
  1.11.8
  1.11.9
  1.11.10
  1.11.11
  1.11.12
  1.11.13
  1.12.0
  1.12beta1
  1.12beta2
  1.12rc1
  1.12.1
  1.12.2
  1.12.3
  1.12.4
  1.12.5
  1.12.6
  1.12.7
  1.12.8
  1.12.9
  1.12.10
  1.12.11
  1.12.12
  1.12.13
  1.12.14
  1.12.15
  1.12.16
  1.12.17
  1.13.0
  1.13beta1
  1.13rc1
  1.13rc2
  1.13.1
  1.13.2
  1.13.3
  1.13.4
  1.13.5
  1.13.6
  1.13.7
  1.13.8
  1.13.9
  1.13.10
  1.13.11
  1.13.12
  1.13.13
  1.13.14
  1.13.15
  1.14.0
  1.14beta1
  1.14rc1
  1.14.1
  1.14.2
  1.14.3
  1.14.4
  1.14.5
  1.14.6
  1.14.7
  1.14.8
  1.14.9
  1.14.10
  1.14.11
  1.14.12
  1.14.13
  1.14.14
  1.14.15
  1.15.0
  1.15beta1
  1.15rc2
  1.15.1
  1.15.2
  1.15.3
  1.15.4
  1.15.5
  1.15.6
  1.15.7
  1.15.8
  1.15.9
  1.15.10
  1.15.11
  1.15.12
  1.15.13
  1.15.14
  1.15.15
  1.16.0
  1.16beta1
  1.16.1
  1.16.2
  1.16.3
  1.16.4
  1.16.5
  1.16.6
  1.16.7
  1.16.8
  1.16.9
  1.16.10
  1.17.0
  1.17beta1
  1.17rc1
  1.17rc2
  1.17.1
  1.17.2
  1.17.3

あとは自分の開発する環境にあったバージョンをインストール

$ goenv install 1.16.10

ワークスペース作成

$ mkdir -p $HOME/go/{bin,src}

~/.zshrc に追記

export GOPATH=$HOME/go
PATH=$PATH:$GOPATH/bin

反映

$ source ~/.zshrc
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?