I need some assistance with installing rbenv and Ruby 2.6.6. I'm currently using zsh, I want to install Ruby 2.6.6, so I did the following:
brew install rbenv
rbenv install 2.6.6
rbenv global 2.6.6
After I did this, I restarted the terminal and I performed the following statement to check the ruby version:
ruby -v
However, the ruby version states:
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
I've tried restarting my terminal and repeated the same steps. I'm new to programming, just need your assistance in helping me fix my setup issues.
Thank you so much for your help
It looks like this is picking up your system Ruby, not the rbenv installed one. You can confirm that with which ruby, which should not say /usr/bin/ruby but something like /Users/<your account/.rbenv/bin (or similar, I don't use rbenv myself anymore). You need to configure your $PATH to make sure this comes before /usr/bin.
The command rbenv init should have taken care of this. If you didn't run it, do that. You can also perform the necessary steps manually, see the documentation for that.
Related
I would like to update the ruby version I have installed from 2.6.3p62 version to 2.7.1
I tried to follow these instructions found here
Because I was having an issue with Ruby before in the past I thought it would be a good idea to go through the uninstalling portion from that tutorial first.
I tried installing again starting from the first step but when I did type rbenv what shows up instead is rbenv is /usr/local/bin/rbenv
I'm not sure why that happens but I went ahead to try to install ruby version 2.7.1 and once I get to checking my ruby version doing ruby -v it shows ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19] instead of ruby version 2.7.1 which I installed.
I tried rbenv versions and what shows up in the console is
system
* 2.7.1 (set by /Users/michaeltorres/.rbenv/version)
I am not sure what is going on but it seems like a ruby version 2.6.3 is still being detected
You have to do a few things, first, let us check what shell you are using
echo "$SHELL"
Now it depends what file you check for your rbenv staff, if are you getting /bin/bash or /bin/sh or '/bin/zsh' then first check using nano or vim to see if it has anything related to RBENV, if not then add the following lines as per your shell.
for bash
vi ~/.bash_profile
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
for Zsh
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
This command is just adding .rbenv you have to restart your terminal/iterm to take effective results.
Now you should have rbenv properly install to make sure it is really installed you can run the following command
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
If it gives you at end all Ok messages than mean you have now everything up. Now use rbenv to install your ruby version, you don't need to uninstall system ruby but you are using rbenv to setup different versions of ruby. Run following command to check which version of ruby available for installation
rbenv install -l
Now you have to use the following command to install your ruby version 2.7.1
rbenv install 2.7.1
Or whatever version you got in its available listing just put same version.
Happy Coding.
I am using zsh and ruby version 2.3.1.
I would like to upgrade it to 2.5.0. I tried to install rvm and ruby version 2.5.0; they were installed, but it also caused many problems because it wasn't able to find other gems.
I removed rvm, and it was back to the way it used to be.
I was wondering if there's a way to upgrade ruby withour rvm. I don't know how ruby was installed before.
When I type which ruby, I get /Users/myname/.rbenv/shims/ruby
Looks like you are using rbenv to manage ruby versions. You can type the following command to install ruby 2.5.0
rbenv install 2.5.0
After that, change your default ruby version to 2.5.0 by typing
rbenv global 2.5.0
For more information and commands, check out the docs.
So I think* RVM may be keeping my Ruby version back artificially. I am getting all sorts of errors in Rails. So I checked the Ruby version I was using. Said it was back a few versions.. so I tried updating to 2.5.0. System said 2.5.0 was already installed? So I checked ruby -v, and got 2.3.3
Here is exactly what my system is telling me:
Johns-MacBook-Pro:PLAYGROUND johnseabolt$ brew install ruby
Warning: ruby 2.5.0_2 is already installed
Johns-MacBook-Pro:PLAYGROUND johnseabolt$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
Johns-MacBook-Pro:PLAYGROUND johnseabolt$
I thought it was an RVM issue maybe? But when I tried to use 2.5.0, I got this:
Johns-MacBook-Pro:PLAYGROUND johnseabolt$ rvm use 2.5.0_2
Required ruby-2.5.0_2 is not installed.
To install do: 'rvm install "ruby-2.5.0"'
Any ideas what is going on? It's a bit of a pain.
This is the relevant line of output:
To install do: 'rvm install "ruby-2.5.0"'
what happens when you run that line of code? It should fix all your problems... :)
I'm not sure what you're saying your problem is exactly, but you can and will have multiple versions of Ruby installed in various places on a modern system. Different applications will require different versions.
In terms of being held back, Ruby doesn't autoupdate like browsers, it's up to you to install the ones you want.
It looks like you have at least one Ruby installed with RVM, and you may have installed with Brew too (which I didn't you know you could do, but I would recommend not to do)
which ruby will tell you which Ruby is loaded in a new shell. It should be in an RVM bin.
Just trying to update to the latest version of Ruby. On ruby-lang.org/en/documentation/installation/#homebrew, I found that you should be able to do it via homebrew:
brew install ruby
However, when I listed the ruby version (ruby -v) after it 'updated' it was still at the old version 2.0.0.
Hermes:~ Sancho$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]
I happened to list the contents of /usr/local/bin/ and I could see a symbolic link:
ruby -> ../Cellar/ruby/2.2.1/bin/ruby
So, I don't know what's happening and why the version still lists the old number and not 2.2.1, as it looks like it should.
There are sym links to for various other ruby tools (erb, gem, irb, rake, rdoc, ri) to version 2.2.1 also.
So what is happening here and how do I correctly install version 2.2.1?
I do have RVM installed also, but I want to update the system version of ruby to the latest.
Easy step
brew uninstall ruby # (if installed)
brew install ruby
then copy the path and paste into the terminal and restart the terminal
check ruby --version
Use Homebrew but make sure /usr/local/bin is early in your path. Ex:
.bashrc
export PATH=/usr/local/bin:$PATH
This will not update the system Ruby version. Instead it will install another version of ruby and this line tells bash to look for the new version instead.
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
$PATH doesn't change in current Terminal session. So please close the Terminal and reopen.
Ref: Jekyll on macOS
i am new to linux. i have kubuntu 11.10 , i have installed ruby 1.9.2 and only after this i have installed rvm. after this i made
rvm install 1.9.2
and
rvm install 1.8.7
and when i use
rvm use 1.8.7
ruby -v
it writes
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
i tryed to use another versions but it writes same anyway, so i think that rvm dont have priority to choose ruby version. how to solve this problem? It's cause i have installed ruby and only after this i have installed rvm?
looking at the output of your rvm list, you have two rubies installed, none of them default.
Looks like you just missed the step to make 1.9.2 the default.
And it seems you didn't modify your .bash_profile file
See Step 3 on this page:
http://beginrescueend.com/rvm/install/
Your file ~/.bash_profile should contain this line:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
(make sure to start a new shell, after modifying .bash_profile)
Then run this: (to set the default Ruby version)
rvm --default use 1.9.2
ruby -v
See also:
http://beginrescueend.com/rubies/default/
First you should establish if rvm is installed correctly, you can determine that by entering type rvm | head -1 in your terminal. If you get the response rvm is a function then rvm is installed correctly.
If it's an installation problem carefully go back over each step, if you still can't figure out what's wrong I highly recommend visiting the #rvm channel on freenode (irc). The creator and other knowledgeable rvmers are almost always available, friendly and willing to help you troubleshoot. If you end up using ruby extensively, you're going to start needing more of the functionality rvm offers (gemsets, etc.) and #rvm can be a great resource when you get tripped up.