Search code examples
goapache-agewails

How to set Wails path for Go on Mac?


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!


Solution

  • 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 ~ %