Cannot use RVM-installed Ruby with sudo
Use rvmsudo
command instead of sudo
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.
Rvm ruby Permission denied
You have a multiuser installation of rvm - this is not recommended because of the troubles you can get with it (like yours).
Since you are already there this should fix it:
rvmsudo rvm get stable --auto-dotfiles
rvm fix-permissions system
Also make sure you are in rvm
group - if not add yourself:
rvm group add rvm $USER
and log in to a new shell (log out and log back in).
EC2: Unable to rvm install ruby
Try to change permissions to rvm directory by this command:
sudo chmod -R a+xwr /usr/local/rvm
rvm install: ruby installation error
Uninstall and reinstall rvm
with
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
For posterity, I'll add that the part of the error that says
Installing Ruby from source to: /usr/share/...
is what got me thinking about a broken installation of rvm which, as I said, is normally entirely contained in the ~/.rvm
directory.
rvm install 2.6.2 is not working in ubuntu 20.04
sudo nano /etc/apt/sources.list
- Add those lines in
sources.list
file
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu focal partner
deb-src http://archive.canonical.com/ubuntu focal partner
sudo apt update
sudo apt install libssl1.0-dev
rvm install 2.6.2
Problem installing RVM
Ack, I didn't mean to post this as a comment on the question. Anyway, if I had to guess, I'd say you installed rvm using sudo or as root. If that is the case, remove it and reinstall without sudo:
sudo rm -rf $HOME/.rvm $HOME/.rvmrc /etc/rvmrc /etc/profile.d/rvm.sh \
/usr/local/rvm /usr/local/bin/rvm
sudo /usr/sbin/groupdel rvm # this might fail, it's not that important
Open new terminal window/tab and make sure rvm is removed:
env | grep rvm
The output should be empty, sometimes it's needed to relogin, after it's empty you can continue:
curl -sSL https://get.rvm.io | bash -s stable
It works perfectly fine installed for the local user.
Related Topics
How to Wrap Link_To Around Some HTML Ruby Code
Double Pipe Symbols in Ruby Variable Assignment
Why Does Adding "Sleep 1" in an After Hook Cause This Rspec/Capybara Test to Pass
How to Use Define_Method to Create Class Methods
Checking If a Variable Is Defined in Sass
How to Sort an Array in Ruby to a Particular Order
Why Doesn't My Cron Job Work Properly
What Does the '&' Mean in the Following Ruby Syntax
What's This &Block in Ruby? and How Does It Get Passed in a Method Here
How to Deal With the Sum of Rounded Percentage Not Being 100
Nomethoderror When Trying to Invoke Helper Method from Rails Controller
Match a String Against Multiple Patterns
"Gem Install Rails" Fails With Dns Error