How to change rvm install location?
Figure out myself by doing some research online, hope this can help someone out:
Suppose you want to move from home/username/.rvm
to /opt/local/rvm
Update you
.bash_profile
or.bashrc
to:if [ -s "$HOME/.rvmrc" ]; then
source "$HOME/.rvmrc"
fi # to have $rvm_path defined if set
if [ -s "${rvm_path-$HOME/.rvm}/scripts/rvm" ]; then
source "${rvm_path-$HOME/.rvm}/scripts/rvm"
fifind your
.rvmrc
under$HOME/.rvmrc
, if not found, create one and put this line in it:export rvm_path=/opt/local/rvm
- move your file to the new location :
mv $HOME/.rvm/* /opt/local/rvm
- execute
rvm repair all
andrvm reload
And you are good to go!
define rvm installation directory
I am too impatient. Found it.
./install --path='/data/' --auto-dotfiles
RVM: how to change default path to home directory?
You can remove all the trace by executing this script
#!/bin/bash
/usr/bin/sudo rm -rf $HOME/.rvm $HOME/.rvmrc /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm /usr/local/bin/rvm
/usr/bin/sudo /usr/sbin/groupdel rvm
/bin/echo "RVM is removed. Please check all .bashrc|.bash_profile|.profile|.zshrc for RVM source lines and delete
or comment out if this was a Per-User installation."
coming from https://rvm.io/support/troubleshooting#sudo
make sure to restart machine to get rid of any environment variables that would point out to the old location (yes it is required in case of playing with system installation).
Setting the RVM path?
After you first execute
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
you shouldn't need to do it again. That line appends the necessary file inclusion information RVM into your .bash_profile
. If you are using bash
(as opposed to zsh, ksh, csh, tcsh or any other shell), then RVM will be accessible each time you open a new session. If you are using a different shell, that line may need to be in a different startup file. For example, if you are using zsh, then you'll probably want to append it to your ~/.zshrc
file.
Having done this, simply running rvm --default use ruby-1.9.2
once should ensure that you have the desired version of Ruby by default. Note, you should not need to add this line to your .bash_profile
or similar.
rvm installation not working: RVM is not a function
You are not using an login shell.
The process of enabling the login flag is described here, also some details on what a login shell is can be found here.
Thus, you need to check the option "Run as login shell" in the Gnome terminal's settings. It is required to open new terminal after this setting the flag.
Sometimes it is required to set the command to /bin/bash --login
.
For remote connections it is important to understand the differene between running interactive ssh
session and executing single commands.
While running ssh server
and then working with the server interactively you are using login shell by default and it's all fine, but for ssh server "command"
you are not using login shell and it would be required to run it with ssh server 'bash -lc "command"'
.
Any remote invocation can have the same problem as executing single command with ssh
.
RVM installed by Ruby not working?
RVM requires a minor addition to your ~/.bashrc
or ~/.bash_profile
to initialize it when you log-in. It is specified in the installation docs in the Post Install section. Did you do that?
Per your rvm info
output, it looks like you haven't completed your installation. All the entries in the output should have corresponding values. So, I suspect you haven't added:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
to your ~/.bashrc
or ~/.bash_profile
and then started a new session.
If you are doing a "Multi-User" installation then you'll need to do a lot more. Have you modified /etc/profile
, or, if you are using Bash as your shell, have you modified /etc/bash.bashrc
to include:
# Load RVM if it is installed,
# first try to load user install
# then try to load root install, if user install is not there.
if [ -s "$HOME/.rvm/scripts/rvm" ] ; then
. "$HOME/.rvm/scripts/rvm"
elif [ -s "/usr/local/rvm/scripts/rvm" ] ; then
. "/usr/local/rvm/scripts/rvm"
fi
and started a new shell?
Personally I don't like the multi-user install as much as the single-user install, and don't recommend it but your mileage might vary.
As a FYI: In a discussion with the RVM maintainers on IRC last year, they told me they do not recommend the system-wide installation, and instead recommend the local "single-user" installation, even for servers.
How to use rvm (ruby version manager) with root account?
I found the solution:
rvmsudo does the trick.
Related Topics
Bash Scripting - How to Set the Group That New Files Will Be Created With
Check If Directory Mounted with Bash
Is \D Not Supported by Grep's Basic Expressions
Understanding Load Average VS. CPU Usage
How to Append the Output to a File
How to Check for Opencv on Ubuntu 9.10
Readelf VS. Objdump: Why Are Both Needed
How to Track Child Process Using Strace
Remote Linux Server to Remote Linux Server Dir Copy. How
Setting a Gdb Exit Breakpoint Not Working
Recursively Cat All the Files into Single File
What Is a Reasonable Amount of Inotify Watches with Linux
Differencebetween Ld_Library_Path and -L at Link Time
Expression After Last Specific Character
Is There a Limit on Number of Tcp/Ip Connections Between MAChines on Linux
How to Remove All White Spaces from a Given Text File
How to Read Websocket Response in Linux Shell
Is Lib{Library Name}.A/.So a Naming Convention for Static Libraries in Linux