Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ERROR: Missing proper 'which' command. Make sure it is installed before using RVM! #2385

Closed
abachuk opened this Issue · 28 comments

7 participants

@abachuk

After installing xcode (OS X 10.9), I see this message
"ERROR: Missing proper 'which' command. Make sure it is installed before using RVM!"
[Process completed]

Terminal is not working, it stuck here... Anyone knows what happened?

@mpapis
Collaborator

it's because of https://github.com/wayneeseguin/rvm/blob/master/scripts/functions/support#L223-L232

edit the file ~/.rvm/scripts/functions/support
and change the lines https://github.com/wayneeseguin/rvm/blob/master/scripts/functions/support#L229-L230 :

    elif which which >/dev/null 2>&1
    then __rvm_which() { which "$@" || return $?; }

to

    elif \which which >/dev/null 2>&1
    then __rvm_which() { \which "$@" || return $?; }

by any chance do you have function or alias for which.

@mpapis mpapis was assigned
@abachuk

thanks, changed the lines, still the same.
how do I check if I have function or alias for which ?

@mpapis
Collaborator

if you can not open terminal disable rvm first in ~/.bash_profile and then in terminal run this:

    if command which --skip-alias --skip-functions which >/dev/null 2>&1
    then echo command which --skip-alias --skip-functions
    elif command which whence >/dev/null 2>&1 && command whence whence >/dev/null 2>&1
    then echo command whence -p
    elif command which which >/dev/null 2>&1
    then echo command which
    elif which which >/dev/null 2>&1
    then echo which
    else echo "ERROR: Missing proper 'which' command. Make sure it is installed before using RVM!" 1
    fi
@abachuk

tried that, looks like now most of commands are not available in terminal like "ls", "curl", "bundle" etc
Probably need to delete my account and create new one. Not sure what happened. IT was totally fine before I installed xcode.

@mpapis
Collaborator

check you shell initialization files for PATH= maybe you just reset it?

@abachuk

currently my ~/.bash_profile looks like this

export PATH=/usr/local/bin

@mpapis
Collaborator

remove that line to fix

@abachuk

looks like it's working now. re-installing rails and everything now... Thank you very much for your help!

@mpapis
Collaborator

ok, closing then as invalid

@mpapis mpapis closed this
@ueg1990

hey, im also stuck in this issue....but i cant change the files as my terminal is stuck....i did rm -rf ~/.rvm after going to single user mode but that didnt make a difference.....any help would be greatly appreciated....really in desperate situation :(

@mpapis mpapis removed OSX invalid labels
@mpapis mpapis added this to the rvm 1.25 milestone
@mpapis
Collaborator

the new version of rvm will not do the exit, run the rvm installation from single user mode via:

su <your user name> -s /bin/sh -c "curl -sSL https://get.rvm.io | bash"
@m5rk

I just installed latest rvm and I'm getting this error, which I believe is related to this pull request.

load_rvm_scripts:12: bad output format specification
WARNING:
      Errors sourcing '/Users/markmceahern/.rvm/scripts/base'.
      RVM will likely not work as expected.
$ rvm --version

rvm 1.25.19 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
$ setopt
alwaystoend
autocd
autonamedirs
autopushd
bashrematch
nobeep
cdablevars
completeinword
correctall
extendedglob
extendedhistory
noflowcontrol
histexpiredupsfirst
histfindnodups
histignoredups
histignorespace
histverify
incappendhistory
interactive
interactivecomments
kshglob
login
longlistjobs
menucomplete
monitor
promptsubst
pushdignoredups
rmstarwait
sharehistory
shinstdin
zle
@mpapis
Collaborator

this should do it

@m5rk

@mpapis That fixed it for me, thanks!

@chobong

Hi,

I am getting this error also with latest rvm

sudo su - user
ERROR: Missing proper 'which' command. Make sure it is installed before using RVM!
WARNING:
      Errors sourcing '/usr/local/rvm/scripts/base'.
      RVM will likely not work as expected.
-bash-4.1$

My scripts/base is using string matching now

  for entry in ${scripts[@]}
  do
    [[ " ${rvm_base_except:-} " == *" $entry "* ]] ||
    source "${rvm_scripts_path}/functions/$entry"  ||
    return $?
  done

  unset rvm_base_except
}
load_rvm_scripts

Please help. Thanks

@mpapis
Collaborator

can you run:

(
  set -xv
  command which --skip-alias --skip-functions which || echo a:$?
  command which whence && command whence whence || echo b:$?
  command which which || echo c:$?
  which which || echo d:$?
)
@chobong

Thanks for your reply
Here is the result

command which --skip-alias --skip-functions which || echo a:$?
+ command which --skip-alias --skip-functions which
+ which --skip-alias --skip-functions which
/usr/bin/which
command which whence && command whence whence || echo b:$?
+ command which whence
+ which whence
which: no whence in (/usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p451/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin:/usr/local/mysql/bin:/root/bin)
+ echo b:1
b:1
command which which || echo c:$?
+ command which which
+ which which
/usr/bin/which
which which || echo d:$?
+ which which
/usr/bin/which
@mpapis
Collaborator

now, can you run:

sudo su - user -c 'echo $PATH'
@mpapis
Collaborator

and:

sudo su - user -c 'which which'
@chobong

Hi, Thanks for your reply.
Here is the output:

# sudo su - user -c 'echo $PATH'
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/rvm/bin:/usr/local/mysql/bin
#sudo su - user -c 'which which'
-bash: /usr/bin/which: Permission denied

But when I check echo $PATH by root, it showed

/usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p451/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin:/usr/local/mysql/bin:/root/bin

Thank you.

@mpapis
Collaborator
@chobong

Hi,

# ls -l /usr/bin/which
-rwx------ 1 root root 25528 Sep 23  2011 /usr/bin/which

I have updated to 755 and now the error has gone.

Thank you so much.

@jmakanjuola

Hi Papsi, this is the issue I'm currently having please help. Thanks!

Last login: Fri Apr 25 06:31:49 on ttys000
-bash: /Users/jubileemakanjuola/.rvm/environments/default: line 22: unexpected EOF while looking for matching ''
-bash: /Users/jubileemakanjuola/.rvm/environments/default: line 25: syntax error: unexpected end of file
-bash: eval: line 5: syntax error near unexpected token
$3'
-bash: eval: line 5: _path+=( $3 )'
-bash: /Users/jubileemakanjuola/.rvm/environments/default: line 22: unexpected EOF while looking for matching
''
-bash: /Users/jubileemakanjuola/.rvm/environments/default: line 25: syntax error: unexpected end of file
-bash: cat: command not found
-bash: uname: command not found
-bash: ps: command not found
ERROR: Missing proper 'which' command. Make sure it is installed before using RVM!
env: bash: Permission denied
-bash: uname: command not found
-bash: ps: command not found
RVM reloaded!

@mpapis
Collaborator

@jmakanjuola please open a new issue and include content of /Users/jubileemakanjuola/.rvm/environments/default

@khaledmohammedfares

I have removed "which" script from the bin directory once , what should i do to fallback and be able to use the command?

@mpapis
Collaborator

@khaledmohammedfares install it with your package manager

@khaledmohammedfares

@mpapis i have tried using Homebrew
brew install which
Error: No available formula for which

@mpapis
Collaborator

@khaledmohammedfares ah thank Apple, there is no package manager that would fix it for you by re-installing some package, I do not know how to help you, even google search turns out empty, please contact Apple support, in worst case you might need to reinstall your system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.