go install github.com/user/hello: open /Users/MyName/projects/go/bin/hello: permission denied
That's what I get. I have the GOROOT in my bashrc file. I have the GOPATH set up right.
Everything else is working correctly when I check with the "-x" flag.
Do I just need to change some permissions? This may just be a BASH question, idk.
edit: same thing when I tried to download and run tetris
go get github.com/k0kubun/tetris ; tetris
go install github.com/k0kubun/termbox-go: mkdir /Users/Cale/projects/go/pkg/darwin_amd64: permission denied
**评论:**
FIuffyRabbit:
analogphototaker:What is the output of
ls -l /Users/MyName/projects/go/bin
calebdoxsey:Nothing
What does
go env
give you?Two ideas:
- Do you have a space in your username? That can sometimes cause problems.
- Maybe the permissions really are set such that go can't create the folders. You could try:
chmod -R 777 ~/projects
.
calebdoxsey: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"
A space in the user on my computer? No, it's just my first name.
I got "Operation not permitted" when I tried chmod on the projects folder.
It sounds like the permissions on your home folder are wrong. Try the same command, but this time with sudo:
sudo chmod -R 777 ~/projects
.If you don't have admin access on your computer (needed for
sudo
) and you don't have write access to your own home directory, then I'm not sure what you can do to fix this.Maybe you can create another folder in your home directory and try again?
cd ~ mkdir go env GOPATH=$HOME/go get github.com/k0kubun/tetris $HOME/go/bin/tetris
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)