<pre><code>go install github.com/user/hello: open /Users/MyName/projects/go/bin/hello: permission denied
</code></pre>
<p>That's what I get. I have the GOROOT in my bashrc file. I have the GOPATH set up right. </p>
<p>Everything else is working correctly when I check with the "-x" flag.</p>
<p>Do I just need to change some permissions? This may just be a BASH question, idk.</p>
<p><strong>edit</strong>: same thing when I tried to download and run tetris</p>
<pre><code>go get github.com/k0kubun/tetris ; tetris
go install github.com/k0kubun/termbox-go: mkdir /Users/Cale/projects/go/pkg/darwin_amd64: permission denied
</code></pre>
<hr/>**评论:**<br/><br/>FIuffyRabbit: <pre><p>What is the output of </p>
<pre><code>ls -l /Users/MyName/projects/go/bin
</code></pre></pre>analogphototaker: <pre><p>Nothing</p></pre>calebdoxsey: <pre><p>What does <code>go env</code> give you?</p>
<p>Two ideas:</p>
<ul>
<li>Do you have a space in your username? That can sometimes cause problems.</li>
<li>Maybe the permissions really are set such that go can't create the folders. You could try: <code>chmod -R 777 ~/projects</code>.</li>
</ul></pre>analogphototaker: <pre><pre><code>GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/MyName/projects/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT=""
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
</code></pre>
<p>A space in the user on my computer? No, it's just my first name. </p>
<p>I got "Operation not permitted" when I tried chmod on the projects folder.</p></pre>calebdoxsey: <pre><p>It sounds like the permissions on your home folder are wrong. Try the same command, but this time with sudo: <code>sudo chmod -R 777 ~/projects</code>.</p>
<p>If you don't have admin access on your computer (needed for <code>sudo</code>) and you don't have write access to your own home directory, then I'm not sure what you can do to fix this. </p>
<p>Maybe you can create another folder in your home directory and try again?</p>
<pre><code>cd ~
mkdir go
env GOPATH=$HOME/go get github.com/k0kubun/tetris
$HOME/go/bin/tetris
</code></pre>
<p>If that works just update your GOPATH in your bashrc. (I actually tend to use $HOME as my GOPATH, and then all my code is in $HOME/src, and everything gets installed to $HOME/bin, which plays nice with other things I want to put in there)</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传