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 is not a function, selecting rubies with 'rvm use ...' will not work
Your console is not running as a login shell and hence have no access to rvm function. If you are running Ubuntu, you can:
- Open console
- Select Edit -> Profile Preferences
- Select tab: Title and Command
- Check box 'Run command as a login shell'
- Restart terminal
RVM is not a function error
I didn't understand what ~/.profile
does correctly; I needed to change ~/.bash_profile
instead. Problem solved!
RVM + Zsh RVM is not a function, selecting rubies with 'rvm use ...' will not work
Turns out that RVM was installed in the wrong place. When I had initially installed RVM I believe I did so with the sudo
command, which ran the multi-user install (installed to /usr/local/rvm
), and not the single user (should be in ~/.rvm/scrips/rvm
), which is why all the posted solutions were not working for me.
I had to uninstall RVM with rvm implode
. There were some permissions issues, so I had to manually go in and delete the files that could not be deleted. Ran the curl command to re-install RVM and now it's installed in the correct place.
Sourcing RVM in my .zshrc
with [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
now works properly and I can switch between rubies.
I'm getting RVM is not a function error on Mac OS X, and no posted solutions work
The solution ended up being on the RVM Help & Support page, in the ".bash_profile not being loaded on OSX" section. It seems that the issue was that I had my terminal set to open with the "default login shell" and when I changed it to instead open with the command "/usr/bash" in Preferences/Setup, "source ~/.rvm/scripts/rvm" started working, and rvm is now being recognized as a function.
RVM is not a function Ubuntu/Mina/rvm
This is most probabaly because rvm is still not loaded to your bash. Load it using:
source ~/.rvm/scripts/rvm
followed by:
rvm use "ruby-2.2.2@default" --create
A permanent fix would be to add following line in your ~/.bashrc
:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
RVM is not a function error when running in ruby script and irb
Try this trick:
%x{bash -c 'source "$HOME/.rvm/scripts/rvm"; rvm use @myapp'}
However, you really can use rvm
as you've specified because even if you've set up the rvm
you then lost your session because your terminal will be closed. Try to setup your environment with session
gem, and control bash session with it.
require 'session'
@myapp = 'ruby-1.8.7-p374'
bash = Session::Bash.new
stdout, stderr = bash.execute 'source "$HOME/.rvm/scripts/rvm"'
stdout, stderr = bash.execute "rvm use #{@myapp}"
puts stdout
# => Using /home/malo/.rvm/gems/ruby-1.8.7-p374
rvm is not a function with root user on ubuntu desktop
Add this to your .bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
If rvm is not in your home folder, you can use the absolute path
[[ -f "<path-to-rvm>/scripts/rvm" ]] && source "<path-to-rvm>/scripts/rvm"
rvm is not a function
update your rvm with:
curl -L get.rvm.io | bash -s stable --auto
instead of adding sourcing to .zshrc
you should enable login shell in your terminal, here is a example: https://rvm.io/integration/gnome-terminal/
Related Topics
Where and How Is the _ (Underscore) Variable Specified
Ruby - Parameters by Reference or by Value
Save Image from Url by Paperclip
Can't Install Rmagick 2.13.1. Can't Find Magickwand.H.
Difference Between Ruby 1.8 and Ruby 1.9
Is It Good Style to Explicitly Return in Ruby
Why Is This Rmagick Call Generating a Segmentation Fault
What Does the Unary Question Mark () Operator Do
Rbenv Not Changing Ruby Version
How to Track System-Specific Config Files in a Repo/Project
The 'Json' Native Gem Requires Installed Build Tools
What Does @@Variable Mean in Ruby
Nokogiri Installation Fails -Libxml2 Is Missing