septerr
septerr

Reputation: 6603

zsh: command not found even though it is in the path

I have an executable in the PATH, which I can execute by cd-ing into the directory that contains it. But I can't execute it outside of that directory. I am on a mac. The executable is called rosetta-cli. It is located at ~/rosetta-cli/rosetta-cli.

I am not very familiar with zsh and bash, I just know the bare minimum to get by :)

septerr@septerr ~ % echo $PATH
/usr/local/opt/node@10/bin:/Users/septerr/.rbenv/bin:/Users/septerr/.rbenv/shims:/usr/local/opt/node@10/bin:/Users/septerr/.rbenv/bin:/Users/septerr/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/septerr/go/bin:/Users/septerr/rosetta-cli/rosetta-cli:/Users/septerr/go/bin:/Users/septerr/rosetta-cli/rosetta-cli

septerr@septerr ~ % rosetta-cli
zsh: command not found: rosetta-cli

septerr@septerr ~ % rosetta-cli/rosetta-cli
CLI for the Rosetta API

Usage:
  rosetta-cli [command]

Available Commands:
  check:construction           Check the correctness of a Rosetta Construction API Implementation
  check:data                   Check the correctness of a Rosetta Data API Implementation

My .zshrc:

eval "$($(go env GOPATH)/bin/assume-role -init)"
eval "$(rbenv init -)"
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])"
export GO111MODULE=on
export GOPROXY=https://gomodules.cbhq.net/
export GONOSUMDB=github.cbhq.net  # For Go 1.13 and laterexport PATH="$HOME/.rbenv/bin:$PATH"
PATH="$HOME/.rbenv/bin:$PATH"
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export MONOREPO_PATH="/Users/septerr/src/sgupta/repo" && source $MONOREPO_PATH/scripts/rc/rc.sh

export PATH="/usr/local/opt/node@10/bin:$PATH"
export PATH=$PATH:$HOME/rosetta-cli/rosetta-cli

My .bash_profile:

eval "$(rbenv init -)"
export GO111MODULE=on
export GOPROXY=https://gomodules.cbhq.net/
export GONOSUMDB=github.cbhq.net  # For Go 1.13 and laterexport PATH="$HOME/.rbenv/bin:$PATH"
PATH="$HOME/.rbenv/bin:$PATH"
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export MONOREPO_PATH="/Users/septerr/src/sgupta/repo" && source $MONOREPO_PATH/scripts/rc/rc.sh
export PATH=$PATH:$HOME/rosetta-cli/rosetta-cli

My .bashrc:

eval "$($(go env GOPATH)/bin/assume-role -init)"
export MONOREPO_PATH="/Users/septerr/src/sgupta/repo" && source $MONOREPO_PATH/scripts/rc/rc.sh

Questions -

  1. Why is rosetta-cli command not available from any directory?
  2. Why some of the paths in $PATH are repeated?

Thank you for your help!

Upvotes: 0

Views: 1885

Answers (2)

HappyFace
HappyFace

Reputation: 4133

Use typeset -Ug path to remove duplicate items from your PATH in zsh.

Upvotes: 1

user1934428
user1934428

Reputation: 22301

You can trust your shell, that if it says command not found, the executable is not in the PATH, respectively it is not an executable.

You showed the PATH and the name of the command, but you did not tell us which directory this executable is supposed to be in. Making an educated guess, I would say that /Users/septerr/rosetta-cli/rosetta-cli should be the place for the executable (but this is something you need to know better than I do). If you agree so far, just do a

ls /Users/septerr/rosetta-cli/rosetta-cli/rosetta-cli

If rosetta-cli is really an executable in this directory, ls should show it, and the x-bit should be turned on.

Upvotes: 0

Related Questions