How to set Wails path for Go on Mac?

369 Views Asked by At

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!

2

There are 2 best solutions below

0
farrukh raja On BEST ANSWER

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 ~ % 
0
Marcos Silva On

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