Dep: Not able to install it correctly

Created on 18 Jul 2017  路  15Comments  路  Source: golang/dep

~ $ go get -u github.com/golang/dep/cmd/dep
~ $ dep init

No command 'dep' found, did you mean:
Command 'rep' from package 'rep' (universe)
Command 'delp' from package 'fp-utils-2.6.2' (universe)
Command 'dwp' from package 'binutils' (main)
Command 'iep' from package 'emboss' (universe)
Command 'xep' from package 'pvm-examples' (universe)
Command 'dp' from package 'speech-tools' (universe)
dep: command not found

~ $ go version
go version go1.8 linux/amd64


Most helpful comment

To resolve this install dep:

go get github.com/golang/dep/cmd/dep

And then add $GOPATH/bin to $PATH.

Example:

export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

All 15 comments

If we need to do any aliasing with the binary, it will be good to be mentioned in the doc.

You will need to install the binary:

go get github.com/golang/dep
cd $GOPATH/src/github.com/golang/dep
go install ./...

something like that

go get installs packages it gets unless a flag is provided. [0]
"For convenience, add the workspace's bin subdirectory to your PATH" [1]

You should have dep installed after running go get, but it needs to be in your path for you to run it anywhere.

[0] https://golang.org/cmd/go/#hdr-Download_and_install_packages_and_dependencies
[1] https://golang.org/doc/code.html#GOPATH

@ivaylopivanov What's the output of go env and your $PATH?

@matjam This is a shortcut: go get github.com/golang/dep/cmd/dep

It'll fetch github.com/golang/dep and install the github.com/golang/dep/cmd/dep package (which compiles dep)

it didn't work for me until I did go install ./...

go figure?

@ivaylopivanov is your $GOPATH/bin in your $PATH?

Thanks @zkanda, I didn't have it as part of the $PATH.

i have the same problem on windows
'dep' is not recognized as an internal or external command

  • How to install it to be global command called everywhere .

To resolve this install dep:

go get github.com/golang/dep/cmd/dep

And then add $GOPATH/bin to $PATH.

Example:

export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

@losintikfos Thanks, problem solved

it is generally preferred that you use released versions (see github releases tab) rather than tip. we don't guarantee the stability of tip.

This is what finally worked for me!

export GOBIN="$HOME/_golangPath01/bin"
export GOPATH="$HOME/_golangPath01/src"
export PATH=$PATH:/usr/local/go/bin:$GOBIN

go get github.com/golang/dep
go get github.com/golang/dep/cmd/dep
cd $GOPATH/src/github.com/golang/dep
go install ./...

@Generalomosco Thanks. Your solution worked for me as well :)

@Generalomosco Thanks. Your solution also worked for me :)

a small trick can help
ln -s /home/"your username"/go/bin/dep /usr/bin/

Was this page helpful?
0 / 5 - 0 ratings