İçeriğe geç

Install or Downgrade Specific Go Version with Brew

  • Summary
  • How to install brew
    • Welcome to brewers
  • How to Install Specific Go Version
  • How to Downgrade Specific Go Version
    • Check Current Go Version
    • Install Specific Go Version
    • Unlink Currently Installed Go Version
    • Force Link the Specific Go Version
    • Check Go Version

Summary

We aim to use the 1.18 go version in our environment. So we set a specific go version while brew install. You may have already installed the latest go version and can downgrade it according to this document. 

How to install brew 

Welcome to brewers

Paste that in a macOS Terminal or Linux shell prompt.


/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

How to Install Specific Go Version

You usually run this command to install go but this will install and link your environment to the latest available version and brew will always try to keep your latest go version. 

brew install go

If you want to keep your go on a specific version you have to set your go version on the install command.

brew install go@1.18

How to Downgrade Specific Go Version

Check Current Go Version

❯ go version
go version go1.19.6 darwin/arm64

Install Specific Go Version

❯ brew install go@1.18
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
bdftopcf                                       fonts-encodings                                liburing                                       lmfit                                          weasyprint

You have 6 outdated formulae and 1 outdated cask installed.
You can upgrade them with brew upgrade
or list them with brew outdated.

==> Downloading https://ghcr.io/v2/homebrew/core/go/manifests/1.18.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/go/blobs/sha256:c53f8f302b803847daf86cc15ed789b361e8e16f6e4f28a6decf821426460a74
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:c53f8f302b803847daf86cc15ed789b361e8e16f6e4f28a6decf821426460a74?se=2022-09-16T09%3A40%3A00Z&sig=VfugrkbgxGDktnBCfG3nAQavqMKIAquNxvhUX2GB67c%3D&sp=r&sp
######################################################################## 100.0%
==> Pouring go--1.18.6.arm64_monterey.bottle.tar.gz
Unlinking /opt/homebrew/Cellar/go@1.18/1.18.6... 2 symlinks removed.
🍺  /opt/homebrew/Cellar/go/1.18.1: 12,436 files, 629.0MB
==> Running `brew cleanup go`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /opt/homebrew/Cellar/go/1.18... (12,426 files, 628.8MB)
Removing: /Users/berkay.akcay/Library/Caches/Homebrew/go--1.18... (175.4MB)

Unlink Currently Installed Go Version

❯ brew unlink go
Unlinking /opt/homebrew/Cellar/go/1.19... 3 symlinks removed

Force Link the Specific Go Version

❯  brew link --force go@1.18Linking /opt/homebrew/Cellar/go@1.18/1.18.6... 2 symlinks created.
If you need to have this software first in your PATH instead consider running:  echo 'export PATH="/opt/homebrew/opt/go@1.18/bin:$PATH"' >> ~/.zshrc

Check Go Version

❯ go version
go version go1.18.6 darwin/arm64

References

Kategori:General

İlk Yorumu Siz Yapın

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir