英文:
Unable to install Go packages in Macbook with M1 chip
问题
当我在delve文件夹中运行命令"go install github.com/go-delve/delve/cmd/dlv"时,在我的go路径中下载go-delve后,终端显示了以下结果:"go install github.com/go-delve/delve/cmd/dlv: mkdir /Desktop: read-only file system"。
当我搜索同样的问题时,我找到了一个网站(https://www.dev2qa.com/how-to-fix-read-only-file-system-error-when-run-mkdir-command-on-macos/),它要求我在MacBook上禁用系统完整性保护,并要求我在Mac启动后立即按住Option键或Command + R键,直到我看到一个"console/terminal"模式的引导。但当我尝试这样做时,没有任何反应。
我不知道该怎么办。请指导我正确安装dlv和其他go包的方法。
英文:
When I ran the command "go install github.com/go-delve/delve/cmd/dlv" in the delve folder, after downloading go-delve in my go path, the terminal showed the following result:
"go install github.com/go-delve/delve/cmd/dlv: mkdir /Desktop: read-only file system"
Terminal result put here
When I googled the same, I came across a website(https://www.dev2qa.com/how-to-fix-read-only-file-system-error-when-run-mkdir-command-on-macos/) which requires me to disable System Integrity Protection on my MacBook and it asks me to hold the option key or command + R immediately after Mac chimes in reboot after starting the MacBook, until I see a boot in a "console/terminal" mode.. But nothing happened when I tried doing that.
I am not knowing what to do. Please guide me through the right way to install dlv and other packages of go successfully on my Macbook.
答案1
得分: 1
- 确保你使用正确的 Go 版本(1.16 或更高版本,arm64)
$ go version
go version go1.17.1 darwin/arm64
- 通过以下命令确保
env
设置正确
$ go env
检查 GOROOT
、GOPATH
、GOARCH
、GOBIN
。
- 尝试直接安装
$ go install github.com/go-delve/delve/cmd/dlv@latest
你遇到的错误是因为你没有 /Desktop
的权限,我确定安装 dlv 不需要这样的权限,它会安装到 ~/go/bin
。
英文:
- make sure you use the right go version (1.16 or later, arm64)
$ go version
go version go1.17.1 darwin/arm64
- make sure the
env
is right by this command
$ go env
check GOROOT
GOPATH
GOARCH
GOBIN
- try to install it directly
$ go install github.com/go-delve/delve/cmd/dlv@latest
your error occurs because you have no permission of /Desktop
, and i'm sure install dlv don't need something like this, it will install to ~/go/bin
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论