英文:
How to set Wails path for Go on Mac?
问题
我正在尝试在我的Mac上使用Wails和Go,但是我在设置正确的路径时遇到了问题。我已经安装了Wails和Go,但是当我尝试使用"wails build"命令构建我的Wails应用程序时,出现了一个错误提示,说"Go not found on path."。
我该如何设置正确的Go路径,以便Wails能够找到它?非常感谢您的帮助!谢谢!
英文:
I'm trying to use Wails with Go on my Mac, but I'm having trouble setting the correct path. I have installed both Wails and Go, but when I try to build my Wails application using wails build, I get an error message saying "Go not found on path."
How do I set the correct path for Go so that Wails can find it? Any help would be greatly appreciated. Thank you!
答案1
得分: 1
按照以下指南进行设置:
devn@macbook-pro-2 ~ % wails doctor
zsh: command not found: wails
devn@macbook-pro-2 ~ % mkdir ~/go
mkdir: /Users/devn/go: 文件已存在
devn@macbook-pro-2 ~ % export GOPATH=~/go
devn@macbook-pro-2 ~ % go install github.com/wailsapp/wails/v2/cmd/wails@latest
devn@macbook-pro-2 ~ % export PATH=$PATH:$(go env GOPATH)/bin
devn@macbook-pro-2 ~ % ~/.bashrc
zsh: 权限被拒绝: /Users/devn/.bashrc
devn@macbook-pro-2 ~ % sudo ~/.bashrc
密码:
sudo: /Users/devn/.bashrc: 找不到命令
devn@macbook-pro-2 ~ % sudo ~/.bash_profile
sudo: /Users/devn/.bash_profile: 找不到命令
devn@macbook-pro-2 ~ % source ~/.bashrc
devn@macbook-pro-2 ~ % wails version
v2.4.1
♥ 如果Wails对您或您的公司有用,请考虑赞助该项目:
https://github.com/sponsors/leaanthony
devn@macbook-pro-2 ~ %
英文:
To set follow these Guidelines:
devn@macbook-pro-2 ~ % wails doctor
zsh: command not found: wails
devn@macbook-pro-2 ~ % mkdir ~/go
mkdir: /Users/devn/go: File exists
devn@macbook-pro-2 ~ % export GOPATH=~/go
devn@macbook-pro-2 ~ % go install github.com/wailsapp/wails/v2/cmd/wails@latest
devn@macbook-pro-2 ~ % export PATH=$PATH:$(go env GOPATH)/bin
devn@macbook-pro-2 ~ % ~/.bashrc
zsh: permission denied: /Users/devn/.bashrc
devn@macbook-pro-2 ~ % sudo ~/.bashrc
Password:
sudo: /Users/devn/.bashrc: command not found
devn@macbook-pro-2 ~ % sudo ~/.bash_profile
sudo: /Users/devn/.bash_profile: command not found
devn@macbook-pro-2 ~ % source ~/.bashrc
devn@macbook-pro-2 ~ % wails version
v2.4.1
♥ If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony
devn@macbook-pro-2 ~ %
答案2
得分: 1
检查是否安装了Wails,可以使用以下命令:
wails doctor
如果未安装,可以使用以下命令进行安装:
go install github.com/wailsapp/wails/v2/cmd/wails@latest
然后创建一个新的Go工作空间 mkdir ~/go
并设置环境变量 export GOPATH=~/go
。
将Go的bin目录添加到系统的PATH变量中 export PATH=$PATH:$(go env GOPATH)/bin
。完成后重新加载shell配置文件 source ~/.bashrc
。最后,使用以下命令验证Wails是否已安装并正常工作:
wails version
英文:
check if the wails is installed by this command:
wails doctor
if it's not installed you can install following this command:
go install github.com/wailsapp/wails/v2/cmd/wails@latest
so create a new Go workspace mkdir ~/go
and set the env variable export GOPATH=~/go
.
Add the go bin directory to your system PATH variable export PATH=$PATH:$(go env GOPATH)/bin
. After this reload your shell profile source ~/.bashrc
. Finally verify if the wails is installed and working following this command:
wails version
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论