Creating a symlink for Ruby while using RVM
Asked Answered
J

1

5

I am following this https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-nginx-on-ubuntu-14-04

But i have installed Ruby using RVM as its easy to maintain ruby.

I am at the step to create a symlink for ruby which under this guide it says

sudo rm /usr/bin/ruby
sudo ln -s /usr/local/bin/ruby /usr/bin/ruby

But since i have used RVM and which i run which ruby i get the following path

root@99atoms-staging:~# which ruby
/usr/local/rvm/rubies/ruby-2.2.0/bin/ruby
Jentoft answered 3/2, 2015 at 6:19 Comment(0)
L
7

Use this:

sudo ln -sfn $(which ruby) /usr/bin/ruby

That is essentially the same for you as doing this:

sudo ln -s /usr/local/rvm/rubies/ruby-2.2.0/bin/ruby /usr/bin/ruby
Lavine answered 3/2, 2015 at 6:27 Comment(3)
can i use this "/usr/local/rvm/rubies/ruby-2.2.0/bin/ruby" as the path for nginxJentoft
If you have used rvm and if you want to set rvm path without symlink then you can use ruby wrapper: /home/sachin/.rvm/gems/ruby-2.0.0/wrappers/ruby It will work!Cholecalciferol
@Harsha You can use that path. But it's generally better to use /usr/bin/ruby because you can keep it the same path even when your versions change.Lavine

© 2022 - 2024 — McMap. All rights reserved.