---
# System prepended metadata

title: Golang 版本切換 on MacOS

---

# Golang 版本切換 on MacOS

目前使用 `Homebrew 4.1.15-28-gd3fd36d`，沒有 `brew switch` 指令而改成 `brew extract`，因此我沒有照這篇：[透過brew來做Golang的版本切換](https://www.evanlin.com/go-version-control-with-brew/)，而是參考這篇的作法： [Install or Downgrade Specific Go Version with Brew](https://berkayakcay.com/install-or-downgrade-specific-go-version-with-brew/)

```
brew install go
```

```
go version
// go version go1.21.3 darwin/arm64
```



### 切換指令

```
brew install go@1.17
brew unlink go
brew link --force go@1.17
```

以上就能切換不同版本的 golang 了

```
go version
// go version go1.17.13 darwin/arm64
```

