LoginSignup
5
4

More than 5 years have passed since last update.

goenvでgolangをインストールする

Last updated at Posted at 2017-11-25

Go言語のversion管理を行うツール
pyenvのGo版みたいなもの

goenvでGoのインストールを行う

$ brew install goenv

$ vim ~/.zshrc
# Go
export GOPATH=$HOME/go
export GOENV_ROOT=$HOME/.goenv
export PATH=bin:$GOENV_ROOT/bin:$GOPATH/bin:$PATH
eval "$(goenv init -)"

$ source ~/.zshrc

$ goenv install -l
Available versions:
  1.2.2
  1.3.0
〜省略〜

$ goenv install 1.9.2 # 最新版のインストール
$ goenv global 1.9.2
$ goenv versions
* 1.9.2 (set by /Users/name/.goenv/version)

Goのバイナリは/Users/name/.goenv/versions/1.9.2/binにある

おまけ

Intellij IDEAのSDKに今回インストールしたgoを指定したい場合、隠しフォルダのままだと指定できないので以下のようにしたりすると選択できるようになる

$ ln -s ~/.goenv ~/goenv
5
4
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
4