---
title: "ターミナルがダサいとモテない。gobrewからgvmに変えたの巻 | grasys blog"
url: "https://blog.grasys.io/post/yusukeh/terminal-gvm"
description: "Changed the Go version manager from gobrew to gvm. Photo by Maarten Scheel on Unsplash 恵比寿でIT企業をやっているとモテると聞いて創業しましたが早いことありがたいことに10年目に突入した長谷川です。 まだモテる成果は出ていません、、、これからです！（もうめんどくさいのでカウントやめました😆） gobrewを使ってましたが、コンパイルエラーが出てどう…"
---

# ターミナルがダサいとモテない。gobrewからgvmに変えたの巻

-   ![](/_astro/noicon.CTHOhNiB_1HMs6A.webp)[yusukeh](/authors/yusukeh/)
-   公開日：2024年12月19日
-   カテゴリー：[Tech](/categories/tech/)
-   タグ：[#シリーズ: ターミナル環境](/tags/シリーズ-ターミナル環境/)[#Go](/tags/go/)[#gvm](/tags/gvm/)

![ターミナルがダサいとモテない。gobrewからgvmに変えたの巻](/_astro/ogp.Dqle7eS-_Z1E8pVs.webp)

Photo by [Maarten Scheel](https://unsplash.com/@maaldoen?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com/?utm_source=medium&utm_medium=referral)

Changed the Go version manager from gobrew to gvm.

恵比寿でIT企業をやっているとモテると聞いて創業しましたが早いことありがたいことに10年目に突入した長谷川です。

まだモテる成果は出ていません、、、これからです！（もうめんどくさいのでカウントやめました😆）

[gobrew](https://github.com/kevincobain2000/gobrew)を使ってましたが、コンパイルエラーが出てどうにもこうにも辛いので[gvm](https://github.com/moovweb/gvm)に変えました😂

gobrewの記事は以下

## ターミナルがダサいとモテない。gobrewでgoのversion管理。goenvを廃止するぞ編

### goenvをやめたい。anyenv依存をやめたい。

medium.com

[gvm](https://github.com/moovweb/gvm)はこちら

## GitHub - moovweb/gvm: Go Version Manager

### Go Version Manager. Contribute to moovweb/gvm development by creating an account on GitHub.

github.com

Requirementでbisonが必要みたいです。

## GitHub - moovweb/gvm: Go Version Manager

### Go Version Manager. Contribute to moovweb/gvm development by creating an account on GitHub.

github.com

ここでも紹介があるようにbisonをInstallしてください。

Plain textcontent\_copy

```
sudo apt-get install bison
```

macOSでもbrewにあります。

Plain textcontent\_copy

```
brew search bison
brew install bison
```

で早速、Installなのですがめっちゃ簡単です。

Plain textcontent\_copy

```
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
```

これで入ります。

ただし読み込まれていないため以下を実行します。

Plain textcontent\_copy

```
source ${HOME}/.gvm/scripts/gvm
```

こちらは.bashrc/.zshrcなどShellに組み込んでおいた方が良いです。

## Usage

まずは実行してみます。

Plain textcontent\_copy

```
> gvm
Usage: gvm [command]

Description:
  GVM is the Go Version Manager

Commands:
  version    - print the gvm version number
  get        - gets the latest code (for debugging)
  use        - select a go version to use (--default to set permanently)
  diff       - view changes to Go root
  help       - display this usage text
  implode    - completely remove gvm
  install    - install go versions
  uninstall  - uninstall go versions
  cross      - install go cross compilers
  linkthis   - link this directory into GOPATH
  list       - list installed go versions
  listall    - list available versions
  alias      - manage go version aliases
  pkgset     - manage go packages sets
  pkgenv     - edit the environment for a package set
  applymod   - apply the go version in go.mod
```

### gvm listall

listallでAvailableなgo versionの一覧を出力できます。

Plain textcontent\_copy

```
gvm listall

~~ 省略 ~~
   go1.23.2
   go1.23.3
   go1.23.4
   go1.24rc1
   release.r56
   release.r57
   release.r58
~~ 省略 ~~
```

こんな感じで最新板が取れるかと・・・

Plain textcontent\_copy

```
gvm listall | sed -e 's/^ *//g' | grep -v rc |  grep ^go | tail -1

go1.23.4
```

### gvm install

installにはいくつかのオプションがあるので事前に確認しておいてください。

Plain textcontent\_copy

```
gvm install --help
Invalid version: --help
Usage: gvm install [version] [options]
    -s,  --source=SOURCE      Install Go from specified source.
    -n,  --name=NAME          Override the default name for this version.
    -pb, --with-protobuf      Install Go protocol buffers.
    -b,  --with-build-tools   Install package build tools.
    -B,  --binary             Only install from binary.
         --prefer-binary      Attempt a binary install, falling back to source.
    -h,  --help               Display this message.
```

それでは実際にinstall

Plain textcontent\_copy

```
go_version=$(gvm listall | sed -e 's/^ *//g' | grep -v rc |  grep ^go | tail -1)
gvm_options=(--with-protobuf --with-build-tools --prefer-binary)
if command -v gvm &> /dev/null; then
  gvm install ${go_version} ${gvm_options[@]}
  gvm use ${go_version}
  gvm list
fi
```

Optionは適当に選んでください。

gvm useでgvmで利用するgoのversionを指定できます。

gvm listはxxenvでいうところのsub-command versionsと同じ挙動で、Installされているgo versionの一覧とそのデフォルトで利用するgo versionの指定の状態を確認するコマンドになっています。

Plain textcontent\_copy

```
gvm list

gvm gos (installed)

=> go1.23.4
   system
```

自分の場合は、go\_versionに最新のgo version番号をセットし  
環境変数でinstall ${go\_version}したものを、そのままuse ${go\_version}しているので上記のようになっています。

Plain textcontent\_copy

```
which go
/Users/yusukeh/.gvm/gos/go1.23.4/bin/go
```

使えそうですね

## go install

lazygitを入れてみましょう。

Plain textcontent\_copy

```
go install github.com/jesseduffield/lazygit@latest
```

自分の環境では無事[lazygit](https://github.com/jesseduffield/lazygit)がInstallされました。

Plain textcontent\_copy

```
which lazygit
/Users/yusukeh/.gvm/pkgsets/go1.23.4/global/bin/lazygit
```

自分はGolangを書くわけじゃないですが、ちょっと新しいModernなShell Environmentを構成するためにgoの環境をセットアップすることは必須🤣

とくに[lazygit](https://github.com/jesseduffield/lazygit)がないと・・・めんどくさくてやってられません😅

goってrustでいうcargo backupやpythonでいうところのpip freezeなものが存在しないけど、みなさんどうやってるんですかね？🤔

自分はgo\_installなるテキストファイルを保存して、マニュアルで管理・・・

Plain textcontent\_copy

```
github.com/Gelio/go-global-update@latest
github.com/tomwright/dasel/v2/cmd/dasel@latest
github.com/jesseduffield/lazygit@latest
github.com/jesseduffield/lazydocker@latest
github.com/jorgerojas26/lazysql@latest
github.com/kndndrj/nvim-dbee/dbee@latest
github.com/dundee/gdu/v5/cmd/gdu@latest
github.com/projectdiscovery/pdtm/cmd/pdtm@latest
github.com/mah0x211/lenv@latest
github.com/charmbracelet/gum@latest
github.com/charmbracelet/glow@latest
github.com/mingrammer/flog@latest
github.com/muesli/duf@latest
github.com/rs/curlie@latest
github.com/mr-karan/doggo/cmd/doggo@latest
github.com/xo/usql@latest
github.com/gohugoio/hugo@latest
github.com/k1LoW/runn/cmd/runn@latest
github.com/xo/xo@latest
......
```

Plain textcontent\_copy

```
for g in $(cat [go_install] | grep -v ^#)
do
  go install ${g}
done
```

以上[gvm](https://github.com/moovweb/gvm)でした。

ターミナル環境について他の記事も書いているので、よろしければこちらもご覧ください！  
[『ターミナルがダサいとモテない』シリーズ一覧](https://blog.grasys.io/tags/series-terminal-update)

転載：[ターミナルがダサいとモテない。gobrewからgvmに変えたの巻](https://medium.com/@yusuke_h/%E3%82%BF%E3%83%BC%E3%83%9F%E3%83%8A%E3%83%AB%E3%81%8C%E3%83%80%E3%82%B5%E3%81%84%E3%81%A8%E3%83%A2%E3%83%86%E3%81%AA%E3%81%84-gobrew%E3%81%8B%E3%82%89gvm%E3%81%AB%E5%A4%89%E3%81%88%E3%81%9F%E3%81%AE%E5%B7%BB-b9c94b0728b2)

この記事は [Medium（@yusuke\_h）](https://medium.com/@yusuke_h) からの転載です。

## この記事を書いた人

[![](/_astro/yusukeh.BvUd2yKE_1mQ6Fp.webp)](/authors/yusukeh/)

### [yusukeh](/authors/yusukeh/)

Fly high. Think deep. Move fast. Go far.🦅

-   [X](https://x.com/yusukeh "X")
-   [GitHub](https://github.com/yusukeh "GitHub")
-   [Medium](https://medium.com/@yusukeh "Medium")
-   [Facebook](https://www.facebook.com/yusuke.exzm "Facebook")
-   [Instagram](https://www.instagram.com/yusukehasegawa/ "Instagram")
-   [LinkedIn](https://www.linkedin.com/in/hasegawa-yusuke-091b4164/ "LinkedIn")

[プロフィールと記事一覧](/authors/yusukeh/)