RVM: how can I dynamically export gem executable directory in my path?
-
27-09-2019 - |
문제
I installed rvm as root to setup an Ubuntu LTS 8.04 as a web hosting server for my rails apps.
rvm is installed in:
/usr/local/rvm
Everything works fine, gems installation included and users are able to use ruby and gem commands.
sudo gem install rails
My problem is that the gems EXECUTABLE DIRECTORY is not included in my PATH and thus I cannot use rails command.
Is there a way to dynamycally include gems executable directory in my PATH?
Can it be done directly through rvm?
해결책
I suspect you don't have RVM setup correctly if it's not in your path.
First, If you run:
type rvm | head -1
and it returns anything other "rvm is a function" then you are not loading it correctly in your profiles.
Second, you may want to include global definitions for the users profiles.
In your users' .bashrc or equivalent
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
And then in your /etc/bashrc
, add your executable path.
다른 팁
Probably your PATH was overwritten somewhere on the way, you can put that on end of your ~/.bashrc
file:
export PATH=/usr/bin:$(echo $GEM_PATH | sed 's/:/\/bin:/g')/bin:$MY_RUBY_HOME/bin:$PATH
it is not pretty but should work