Dep: Cannot install dep on Ubuntu 17.04, permission denied for mv

Created on 7 Mar 2018  路  8Comments  路  Source: golang/dep

What version of dep are you using (dep version)?

Not installed

What dep command did you run?

I tried to run curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh as specified on the readme.
I'm using Ubuntu 17.04

What did you expect to see?

dep installed correctly

What did you see instead?

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4416  100  4416    0     0   4416      0  0:00:01 --:--:--  0:00:01 41271
ARCH = amd64
OS = linux
Will install into /home/criscola/go/bin
Fetching https://github.com/golang/dep/releases/latest..
Release Tag = v0.4.1
Fetching https://github.com/golang/dep/releases/tag/v0.4.1..
Fetching https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64..
Setting executable permissions.
Moving executable to /home/criscola/go/bin/dep
mv: cannot move '/tmp/tmp.dCldkcZbuT' to '/home/criscola/go/bin/dep': Permission denied

Most helpful comment

Change the permissions for the folders bin and pkg with the command:

chown criscola:criscola $GOPATH/bin $GOPATH/pkg

Try again and it will work =)

All 8 comments

Clearly it is a problem with permissions on your side.

Using the same curl command as yours, it downloaded and moved the executable correctly to my $GOPATH/bin/dep

Mmmh yes but do you think this is because my gopath is in my home directory? If yes, how do I make dep install? I'd prefer not to change my gopath if possible

@criscola no relation with your $GOPATH location only with directory permissions. Can you share your $GOPATH user and group permissions? You can do with ls -l $GOPATH.

@criscola were you able to install it?

Right! No, tomorrow I will post the permissions.

Here they are:

drwxr-xr-x 2 root     root     4096 Mar  3 18:28 bin
drwxr-xr-x 3 root     root     4096 Jan 31 22:05 pkg
drwxr-xr-x 9 criscola criscola 4096 Mar  7 12:52 src

Change the permissions for the folders bin and pkg with the command:

chown criscola:criscola $GOPATH/bin $GOPATH/pkg

Try again and it will work =)

Great thank you, only thing I had to execute the command as root using sudo.
Cheers

Was this page helpful?
0 / 5 - 0 ratings