Gangmax Blog

How to make RVM and Sdkman coexist

RVM and Sdkman are very useful tools to manage and work with multiple Ruby/Groovy environments. After installing both of them want to add some lines into the dotfile(.bashrc/.zshrc) and make the lines at the end of this file, which is impossible, however.

After some testing, here is what I did to make both of them work.

.bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...

# 1. Note that make RVM lines at the end of the file. If not, RVM doesn't work
# properly(getting the "Warning! PATH is not properly set up" warning).
# However, Sdkman can work if you put the Sdkman lines before the RVM lines.
#
# 2. Remember to check the other dotfiles such as ".bash_profile" and
# ".profile"files, to make sure there is not RVM/Sdkman lines in them. If it
# happens, you configuration in the ".bashrc" file may not work properly
# because of the content there.

#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/home/gang/.sdkman"
[[ -s "/home/gang/.sdkman/bin/sdkman-init.sh" ]] && source "/home/gang/.sdkman/bin/sdkman-init.sh"

# Add RVM
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Comments