How to set Wails path for Go on Mac?

王林
Release: 2024-02-08 23:57:35
forward
1084 people have browsed it

如何在 Mac 上设置 Go 的 Wails 路径?

php Editor Xigua brings you an article on how to set up Go’s Wails path on Mac. Wails is a very useful tool when developing desktop applications with Go. But setting up Wails paths on Mac can be a bit cumbersome. This article will introduce in detail how to correctly set Go's Wails path so that you can successfully use Wails to develop desktop applications. Whether you are a newbie or an experienced developer, this article will provide you with a step-by-step guide to master this technique easily. Let’s learn together!

Question content

I'm trying to use Wails with Go on my Mac, but I'm having trouble setting the correct path. I have Wails and Go installed, but when I try to build my Wails application using wails build I get an error message: "Go not found on path."

How do I set the correct path for Go so Wails can find it? Any help would be greatly appreciated. Thanks!

Workaround

To set up, 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 ~ %
Copy after login

The above is the detailed content of How to set Wails path for Go on Mac?. For more information, please follow other related articles on the PHP Chinese website!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template