Golang在我新的Mac上出现了权限问题,刚刚安装的。

huangapple go评论95阅读模式
英文:

Golang is having permission issues on my new Mac, fresh install

问题

一点背景信息:

我已经在Golang上工作了将近2年了,就在昨天我买了一台Mac电脑,我对这个操作系统还很陌生,之前我只在Linux上使用过Golang,包括Ubuntu和Arch,整个过程都很顺利,根据大多数帖子来看,在Mac上也应该是一样的。

问题所在:

我注意到当我尝试运行我的工作项目的命令时,我收到了权限错误,我尝试使用chmod提供提升的访问权限,但是似乎没有起作用,我已经更新了路径变量,卸载了Golang,安装了其他版本,甚至使用了brew,但是仍然出现相同的错误,

go mod tidy
example.com/m: open /Users/andrewalizaga/Library/Caches/go-build/78/78eb7bcc7e29eb28c3e9df7a741641913f745d9b271d51e223c70e81e0e11def-d: permission denied

这是我一直得到的错误,似乎与缓存和文件被锁定有关,当我尝试运行一个全新的项目时出现了这个错误,所以似乎与我的工作相关的东西无关。我非常感谢任何帮助,提前谢谢。

英文:

a little bit of context

I have been working on Golang for almost 2 years now, just yesterday I got a Mac, I'm new on this OS, previously I have only worked Golang on linux, both Ubuntu and arch and the process has been straightforward, as it seems on mac according to most posts.

The Issue

Rn I notices that when trying to run commands for my work projects I was receiving permission errors, I tried to use chmod to provide elevated access, but nothing seems to work, I have updated path variables, uninstall golang, install other versions, use brew even, but the same error always shows up,

go mod tidy
example.com/m: open /Users/andrewalizaga/Library/Caches/go-build/78/78eb7bcc7e29eb28c3e9df7a741641913f745d9b271d51e223c70e81e0e11def-d: permission denied

this is what I always get, seems to be about cache and files being locked, this one appear when I tried to run a brand new project, so it does not seem to be about my work related stuff. I appreciate any help, thanks in advance

答案1

得分: 1

好的,以下是翻译好的内容:

好的,现在我明白了...有点明白。

我刚刚通过手动给我的管理员用户一些额外的访问权限来修复了它,错误是在一个库文件夹和一个缓存文件夹中出现的,所以使用以下命令:

sudo chown -R $username /Users/$username/Library

我能够通过这个错误,它的工作方式就像在Linux中一样,令我困扰的是不知道为什么一开始需要这样做,我的用户是管理员,并且这是一个全新的安装,我阅读的所有文档都没有提到需要手动为用户提供这个权限,我猜想MacOS也有一个根用户和管理员用户的区别,但我仍然不明白为什么这会影响到我的情况。

英文:

Ok, so now I got it... kinda

I just manage to fix it by manually giving my admin use some extra access to specific folders, the error was popping with a library folder and a cache folder so using the following command

sudo chown -R $username /Users/$username/Library

I was able to pass this error and just it works just as in Linux, that part that bugs me still is not knowing why was this needed in the first place, my user is admin and it's a fresh install, all the documentation I read made no mention of needing to provide this manually to your user, I'm guessing MacOS has a distinction between root and admin as well, but I still don't see why this affected on my case

huangapple
  • 本文由 发表于 2023年6月23日 19:21:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76539615.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定