I've read similar questions but still unlucky. In my server (Ubuntu 16.04) I have two user: root and other. I want to config a Rails project.
Now, after some configuration I installed the v2.5 version of Ruby (required) as a root user using Rbenv, but in the other profile the version kept the same as default (v2.3).
I've managed to know set the proper version in the other profile. When I do:
rbenv versions
The output is the following:
system
* 2.5.0 (set by /home/other/.rbenv/version)
But when I do:
ruby -v
The version keeps being the default one:
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
How to set the version to v2.5?
Thanks in advance.
when you run ruby -v, it's considering your ruby installed by apt install ruby.
You must remove ruby-build with apt remove ruby-build and clone the ruby-build to inside rbenv directory and then install and set as global with rbenv.
I want to recommend you to read and follow this tutorial after remove local ruby-build.
Related
I had the original ruby v2.6.8 I believe on my mac os. I wanted to upgrade to ruby 3.1.2 to get access to rails.
I installed ruby via homebrew, however I decided it woud be easier to manage using rbenv. I went to uninstall ruby via homebrew, and then instaled ruby 3.1.2 with rbenv.
Now when I use the
ruby -v
-bash: /usr/local/opt/ruby/bin/ruby: No such file or directory
using the command which ruby brings me this:
/Users/user/.rbenv/shims/ruby
So the ruby is there, and rbenv claims it installed ruby 3.1.2, but did homebrew install all of ruby including the version osx came with? Im pretty sure thats a yikes moment if it did. I also can't use any ruby commands under these circumstances so I don't really know what to do from here?
How do I get my $PATH to recognize the rbenv path to ruby as the global path? I'm on MacOs 11.3.1 BigSur if thats relevant.
Follow the next steps to set up rbenv, and ruby 3.1.2.
Step 1
brew install rbenv
Step 2 Add the following lines to your .zshrc file
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init - zsh)"
Step 3
brew update && brew upgrade ruby-build
Step 4
rbenv install 3.1.2
rbenv global 3.1.2
I'm having trouble updating ruby and rails on my Ubuntu system.
rails --version
Rails 4.1.7
ruby --version
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]
Originally I was using rbenv but I want to switch to RVM as I am not very experienced. I've used sudo apt-get remove on rbenv, ruby, and rails but even after that the versions above do not go away. rbenv aparently exists still as well.
rbenv --version
rbenv 0.4.0-129-g7e0e85b
Installing RVM after quote on quote removing rbenv does not change the versions above either.
These uninstallation instructions may be helpful to you if you're having trouble. In brief, run rm -rf ~/.rbenv and then remove anything rbenv added to your startup files. Note that if you installed rbenv using the instructions on the GitHub page (i.e. cloning the Git repo), you won't be able to uninstall it (or Rails, Ruby, etc., since those are presumably stored in your .rbenv directory) with apt-get.
If you want to keep using rbenv and upgrade to the latest version of Ruby and Rails, I suggest installing ruby-build if you haven't already, then running rbenv install 2.2.1, followed by rbenv global 2.2.1, followed by gem install rails. Check out the local/global stuff in the "Command Reference" section of the rbenv documentation for more information on selecting which version of Ruby you want to use.
I'm trying to install Ruby + Rails on Ubuntu 14.04. I need more than one user to have access to Ruby, so I installed rbenv with ruby-build in the /opt/.rbenv directory. Is that right?
If I try to install a version of Ruby using
rbenv install 2.1.3
it is installed in ~/username/.rbenv/versions, not in /opt/.rbenv/versions.
I don't want to give the second user access to the other user's home directory.
How can I install Ruby in /opt/.rbenv? Or is there another solution?
You can use the RBENV_ROOT environment variable:
sudo RBENV_ROOT=/opt/.rbenv rbenv install 2.1.3
See documentation.
I'm running Ubuntu 12.04 LTS, and installed Ruby via RVM.
The problem is, when I type ruby -v into the terminal, it says that my Ruby version is 1.8.7, and using the shotgun gem for Sinatra also says that I'm running Ruby 1.8.7.
But when I type rvm list it shows that the only version of Ruby that I have installed is 2.0.0 and it is my current and default version.
I installed Ruby 2.0.0 via RVM and it is the only version I had installed on my machine.
Now when I tried to install Rails 4 but got an error saying that I need Ruby 1.9 or higher.
How do I know what version am I really on, and how do I set 2.0.0 as my only version?
On your terminal, try running:
which -a ruby
This will output all the installed Ruby versions (via RVM, or otherwise) on your system in your PATH. If 1.8.7 is your system Ruby version, you can uninstall the system Ruby using:
sudo apt-get purge ruby
Once you have made sure you have Ruby installed via RVM alone, in your login shell you can type:
rvm --default use 2.0.0
You don't need to do this if you have only one Ruby version installed.
If you still face issues with any system Ruby files, try running:
dpkg-query -l '*ruby*'
This will output a bunch of Ruby-related files and packages which are, or were, installed on your system at the system level. Check the status of each to find if any of them is native and is causing issues.
Run this command:
rvm get stable --auto-dotfiles
and make sure to read all the output. RVM will tell you if something is wrong, which in your case might be because GEM_HOME is set to something different then PATH.
The ruby version 1.8.7 seems to be your system ruby.
Normally you can choose the ruby version you'd like, if you are using rvm with following. Simple change into your directory in a new terminal and type in:
rvm use 2.0.0
You can find more details about rvm here: http://rvm.io
Open the website and scroll down, you will see a few helpful links. "Setting up default rubies" for example could help you.
Update:
To set the ruby as default:
rvm use 2.0.0 --default
If you have access to a console in the context you are investigating, you can determine which version you are running by printing the value of the global constant RUBY_VERSION.
Accidently I have installed both versions of ruby on my system and now the default version is set to
$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
but I need to set the default version to 2.0.0...
for this I used the command
$ rvm 2.0.0p294 --default
but it says rvm is not currently installed though I installed it, typing various commands(via google) .
Also I want to install an Integrated Ruby shell in ubuntu 13.04, do suggest how to do it.
I have also installed Aptana Studio on my system, now how should I get started with it.
Finally, the last problem is tell me how to check whether rails is currently installed in my system or not...
Thanx in advance!!
to use a gemset try writing
rvm use ruby_gemset_version
to check the rails version try to type rails -v
you have to install RVM (ruby version manager), then you have control to use any specific versions of ruby, and coming to rails you have to manually install rails gem once you have installed rvm and selected a version.
This would be helpful to install rvm
https://rvm.io/rvm/install
After installation you have to install ruby versions.
Then you can use the following cmd
$ rvm use 2.0.0
to use ruby 2.0.0
Thank you.
Go to this http://rvm.io/rvm/install It has instruction to install and cofigure RVM. It is dependant on CURL lib. So make sure you have curl installed in your system, if not then the command is
#sudo apt-get install curl
Once it is intalled and configured properly.
On Ubuntu:
GoTo Terminal > Profile Preferences > Title and Command > Set checkbox for (Run command as login shell)
Install rubies using rvm install.