# Mac下Go1.18以及以上版本安装fresh的坑

1,402 阅读1分钟

因为我的go版本是 go version go1.18 darwin/amd64 所以直接安装 go get github.com/pilu/fresh 会爆以下错误

go: go.mod file not found in current directory or any parent directory.
	'go get' is no longer supported outside a module.
	To build and install a command, use 'go install' with a version,
	like 'go install example.com/cmd@latest'
	For more information, see https://golang.org/doc/go-get-install-deprecation
	or run 'go help get' or 'go help install'.

所以换一种方式安装

go install  github.com/pilu/fresh

安装完成后,会发现找不到fresh命令

所以,要把环境变量配置一下

vim ~/.zshrc

加上下面的配置

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

然后还有一个坑,不能直接运行 fresh, 在Mac用 ./fresh