Because sudo resets the $PATH
environment variable, running a Ruby command through sudo
will not invoke the currently selected Ruby, but will invoke the system Ruby instead. To solve this problem you need to invoke sudo commands using chruby-exec
:
sudo chruby-exec ruby-1.9.3-p448 -- rake --version
Or, you can obtain a root prompt first using sudo -s
, then switch Ruby, then run the command:
# Obtain root prompt
sudo -s
# Initialize chruby and switch Ruby
source /usr/local/share/chruby/chruby.sh
chruby ruby-1.9.3-p448
# Run the command we wanted
rake --version
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4