Installing newer version but still older version active - rvm

I needed some features from a newer version so I installed 1.9.3 . However after the installation when I write "ruby --version" it still gives me back 1.8.7.
Any idea how to update it?
I used rvm install ruby-1.9.3-p0 to install it, and this worked on other machines, just not on this one

there is a shortcut for your needs:
rvm use 1.9.3-p0 --install --default
where:
--install will install this ruby if it is not yet installed
--default will set this ruby default so it will be loaded when you open new shell

Related

YAML safe loading is not available

When I want to install compass with gem install compass, I occurred with this error:
YAML safe loading is not available.
Please upgrade psych to a version that supports safe loading (>= 2.0).
what The cause of this error and how can I solve the problem?
It sounds like the psych gem needs to be updated. Try running gem install psych and then gem update psych.
Suggested by looking at the psych readme file here: https://github.com/ruby/psych/blob/master/README.md
EDIT: you might also have to update your version of ruby. This depends on how you have installed ruby, but #ewerx has one suggestion in their answer.
To resolve this I first upgraded Ruby from 2.0.x to 2.4.2 (https://gorails.com/setup/osx/10.12-sierra):
rbenv install 2.4.2;
rbenv global 2.4.2
Then updated gems:
sudo gem update --system;
gem update
It may be sufficient to just update gems.
The following part of the post on https://gorails.com/setup/osx/10.12-sierra solved my issue.
We will be setting up a Ruby on Rails development environment on macOS 10.12 Sierra.
Older versions of OS X are mostly compatible so follow along as far as you can and then Google search for any problems you run into. There are plenty of people who have documented solutions for them.
Installing Homebrew
First, we need to install Homebrew. Homebrew allows us to install and compile software packages easily from source.
Homebrew comes with a very simple install script. When it asks you to install XCode CommandLine Tools, say yes.
Open Terminal and run the following command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Installing Ruby
Choose the version of Ruby you want to install:
Now that we have Homebrew installed, we can use it to install Ruby.
We're going to use rbenv to install and manage our Ruby versions.
To do this, run the following commands in your Terminal:
brew install rbenv ruby-build
Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
Install Ruby
rbenv install 2.5.1
rbenv global 2.5.1
ruby -v

How to install rails bundle in the right place

I installed ruby-1.9.3 by my homebrew, so it locate on /usr/local/Cellar/ruby/1.9.3-p286/.
After installed Rails by rvm, I do command bundle install but the bundles were all installed to the /Library/Ruby/Gems/1.8/gems which is an old-version ruby installed with my OS X.
What can I do to let the bundles install in the right place?
Try this
$ rvm use 1.9.3--system
Use either rvm or rbenv to manage different versions of ruby. You could also consider JewelryBox, which does pretty much the same thing, but with a prettier GUI.

Passenger on Apache 2 Installation fails with Your RVM wrapper scripts are too old

I'm trying to install passenger on a virtual rootserver (which has multiple user accounts) but running 'passenger-install-apache2-module' results always in the following error:
Your RVM wrapper scripts are too old. Please update them first by running 'rvm get head && rvm reload && rvm repair all'.
Following this given instructions does not take any effect.
Before installing passenger, i installed RVM as multiuser / mixed mode according to https://rvm.io//rvm/install/
After that I did (using a non root-account):
rvmsudo rvm user gemsets
rvm install 1.9.3
gem install rails
gem install passenger
and lastly passenger-install-apache2-module
I searched for hours on this problem but could not find any working solution yet.
Any suggestions ? Thanks in advance!
Try to install passenger-install-apache2-module like this :
rvmsudo passenger-install-apache2-module
I just encountered this very same issue. I'm using ZSH, but switching to Bash also failed on first attempt.
My solution was to switch to Bash with the --login flag:
/bin/bash --login
Then I noticed that my RVM ruby had become unset, so I re-set using:
rvm use ruby-1.9.3 --default
Once this was done, the following worked as expected:
passenger-install-apache2-module
Rich
I have had similar issue and have taken extreme steps on my centos 6.3 system after struggling for days! In specific, I failed to install standalone phusion passenger apache2 module on gemsets other than default and global. I have taken the following steps and now, it works for me:
Login as root (I hope you know what you're dealing with)
To completely uninstall existing rvm, invoke
[root#] rvm implode
Install stable rvm, invoke
[root#] curl -L get.rvm.io | bash -s stable
run rvm shell,
[root#] source /etc/profile.d/rvm.sh
check rvm requirements, invoke
[root#] rvm requirements
and install all requirements.
Install ruby 1.9.3, invoke
[root#] rvm install 1.9.3
Install current rubygems, invoke
rvm rubygems current
Set default to ruby 1.9.3, invoke
[root#] rvm use 1.9.3 --default
Add other users who are using rvm to rvm group, invoke
[root#] usermod -a -G rvm USERNAME
If USERNAME is currently logged in, pls logout so the group add will take effect.
Make sure rvm group added, invoke
[USERNAME#] groups
Create and Switch to a new gemset on ruby 1.9.3, invoke
[USERNAME#] rvm use 1.9.3#mygemset --create
Confirm that you're on the right gemset, invoke
[USERNAME#] rvm gemset name
Install passenger gem, invoke
gem install passenger
To skip gem documentation instead, invoke
[USERNAME#] gem install passenger --no-ri --no-rdoc
or specify them in your .gemrc file
To install apache2 mod, invoke
[USERNAME#] passenger-install-apache2-module
Hope that helps!

How do I install same version of ruby as different names with rvm?

After I installed a version of ruby with rvm, I noticed that some minor configuration issue on installation process. So I wanted to try to install with another configuration options, but I don't want to spoil the installed ruby at all.
So I just to attempt to backup the installed ruby before rvm reinstall.
(cd .rvm/rubies && mv ruby-1.9.3-p194 ruby-1.9.3-p194.org)
In my case, reinstallation fixed the issue, I didn't rollback ruby. So, I don't know this can work.
Are there any clean or correct way? Just for future references.
you can install named rubies:
rvm install 1.9.3-test1 [options]
and after it worked set it as default:
rvm use 1.9.3-test1 --default
or reinstall the original 1.9.3, named rubies are useful especially for testing compilation flags or patched rubies:
rvm install 1.9.3-performance --patch falcon
You can also have different gemsets with the same version using
rvm create gemset projectname

can't get "rails console" to work on ubuntu 11.10

I want to use rails console and I'm using ubuntun 11.10 currently I have found the issue
error is something :
completion.rb:9:in `require': no such file to load -- readline (LoadError)
and I found a way to solve it:
http://blog.jasonmeridth.com/2010/11/25/readline-error-with-rvm-and-rails-3.html
but seems in ubuntu 11.10 the libreadline5-dev is missed and it is replaced with version 6
I installed version 6 and also I get the version 5 from
https://launchpad.net/ubuntu/oneiric/i386/libreadline-gplv2-dev/5.2-9ubuntu1
but yet if I try to run following code :
ruby extconf.rb
I'll get following lines :
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no
the "no"s part is my problem , so how can I solve this problem?
Ubuntu 11.10 uses newer readline library which not in sync with the readline package offered by rvm
To solve this (assuming you use single-user installation of rvm) do:
1) ensure you have installed ubuntus readline and editline dev packages
sudo apt-get install libreadline6 libreadline6-dev
2) configure ruby's readline extension to use the systems libs, not rvm's packages
rvm pkg uninstall readline
cd ~/.rvm/src/ruby-1.9.2-p290/ext/readline
ruby extconf.rb --with-editline-dir=/usr/ --with-readline-dir=/usr/
make
make install
3) go to your project and start up the rails console
Tip: You can call
rvm requirements
to see what ubuntu packages should be installed to use rvm ruby
You have to install the readline development packages before compiling ruby. Just run
sudo apt-get install libreadline6-dev
Alternative (as suggested in the article you linked) you can use RVM to get the appropriate readline sources by running
rvm package install readline
Edit: Once you've installed the readline packages from source, you can install your rubies like this
rvm install 1.9.3 --with-readline-dir="$rvm_path/usr"
If you alredy have installd a specific ruby, just use reinstall instead on install.