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 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
.
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 + 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.
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
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/
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"
Related Topics
An Error Occurred While Installing Debugger-Linecache (1.1.1), and Bundler Cannot Continue
Adding an Instance Variable to a Class in Ruby
Better Way to Turn a Ruby Class into a Module Than Using Refinements
How to Introspect Things in Ruby
How to Use Define_Method Inside Initialize()
Rails Convert String to Number
Carrierwave: Create the Same, Unique Filename for All Versioned Files
Gem File with Git Remote Failing on Heroku Push
Rubymine - No Ruby Interpreter Configured for the Project
Parsing Simple Xml with Nokogiri
How to Define_Method in Rails Models
Find Records with Datetime That Match Today's Date - Ruby on Rails
Sorting a Two-Dimensional Array by Second Value
Code to Generate Gaussian (Normally Distributed) Random Numbers in Ruby
Possible to Alias a Belongs_To Association in Rails