Error "command not found" after installing go-eval

You'll need to add GOPATH/bin to PATH.

PATH="$GOPATH/bin:$PATH"

Update [Go 1.8 and above]: GOPATH will default to $HOME/go. The above will not work if GOPATH is not explicitly set.

To set both, add this to your .profile file:

export GOPATH="$HOME/go"
PATH="$GOPATH/bin:$PATH"

Is the binary go-eval in $GOPATH/bin? Are you running the command with $GOPATH/bin/ as your working directory? If not, thats likely the problem.

go get & go install installs go binaries (if any) in $GOPATH/bin

Check $GOPATH/bin for the go-eval binary. If its there, try running it from $GOPATH/bin with ./go-eval. If that works, you're good.

In future, if you wish to run go binaries found in $GOPATH/bin from anywhere in your shell, add the following to your .bashrc or profile:

export PATH=$PATH:$GOPATH/bin

Then restart your terminal or run . ~/.bashrc or . /etc/profile

When running go install go-eval I get:

can't load package: package go-eval: cannot find package "go-eval" in any of: /usr/local/go/src/go-eval (from $GOROOT) $HOME/golang/src/go-eval (from $GOPATH)

You get the above error because go-eval is not in $HOME/golang/src/go-eval. Running go get github.com/sbinet/go-eval/ will download the source to $GOPATH/src/github/sbinet/go-eval/. If you want to run go install go-eval, you have to specify the package name relevant to its position in the directory hierarchy in $GOPATH/src.

e.g. go install github/sbinet/go-eval


Ran into this issue while using export PATH="~/go/bin:$PATH".

Seems the ~ was causing problems and changing to the full path worked.

Try something like this instead, which won't use a tilde:

export PATH="$HOME/go/bin:$PATH"

Tags:

Macos

Go