Install ruby with asdf on MacOS via Homebrew - ruby

I recently wanted to install a different Version of ruby and Rails on MacOS Big Sur 11.5 Beta. I Installed asdf via Homebrew. I wanted to run rails server but got the Message:
No preset version installed for command ruby
Please install a version by running one of the following:
asdf install ruby 3.0.2
or add one of the following versions in your config file at /Users/philippkorn/.tool-versions
ruby 3.0.1
When I try to run any asdf install ruby command (i.e. asdf install ruby latest) I get the following error message:
~ $ asdf install ruby latest (base)
Version not found
I tried reinstalling asdf with homebrew but the error persists...

I am facing same situation. It seems to be fixed soon.
https://github.com/asdf-vm/asdf-ruby/issues/239
Edit ~/.asdf/plugins/ruby/bin/install and apply this patch then the problem is fixed for me.
- if [[ -n "$matching_version" ]]; then
+ if [[ -z "$matching_version" ]]; then

Related

How to update ruby on mac version 10.15.5

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.

Why is ruby -v still showing version 2.0.0 even after successfully installing ruby 2.5.3?

I'm following this tutorial: https://jekyllrb.com/docs/installation/macos/#homebrew
I've successfully installed ruby 2.5.3, however, when I run "ruby -v" on the command line in Terminal, it still says ruby 2.0.0.
My friend told me something about local vs universal installation of ruby and how that can create a conflict, but I'm completely new to this so I'm having trouble understanding how to update the 2.0.0 to 2.5.3 (which I've successfully installed on my machine).
I suggest you install RVM: https://rvm.io/
The install instruction is on the site.
After you're done installing RVM do.
rvm install 2.5.3
Then test with ruby -v to check if you have the version you want (2.5.3). If not we can help you from that point.

I cannot update Ruby on Homebrew from 2.0.0 to 2.3.1

I am trying to upgrade Ruby because I need to setup a Jekyll template, and I need to latest version to do it. Since I have a Mac running Sierra, I already have Ruby preinstalled as well as the Homebrew installation. When I install it using brew install ruby, it works, but when I check the version, it is still at 2.0.0 instead of 2.3.1 where it should be. Homebrew says I have 2.3.1, but the CLI says I have 2.0.0. I tried to use brew link --override ruby to make it work, but it said everything was working and it got me nowhere.
Use rbenv and plugin ruby-build. It will keep several versions of ruby on the one machine.
After install go to directory with your code, run rbenv install 2.3.1 and create file .ruby-version containing 2.3.1. All scripts running from this directory will use ruby 2.3.1.
Or you will able to set ruby version for all running scripts - rbenv global 2.3.1

Error installing ruby-2.0.0-p353 using RVM

I am trying to install and set up my dev environment for RoR, on a Mac OSX Maverick 10.9.
After run the command:
$ rvm install ruby-2.0.0-p353
the following error out:
Installing required packages: libyaml, openssl.
Error running 'requirements_osx_brew_libs_install libyaml openssl',
showing last 15 lines of /Users/wlinares/.rvm/log/1388963243_ruby-2.0.0-p353/package_install_libyaml_openssl.log
esac;
return $ret
}
}
I downloaded libyaml from http://pyyaml.org/download/libyaml/ and installed following the default instructions.
Then I made the same for openssl so it was installed successfully under: /usr/lib/
Anyone has overcome this error? thanks!
You could try:
$ rvm install 2.0.0-p353 --autolibs=enable
After trying many tricks I could not overcome the issue, then I uninstalled everything and restart the process as a beginner I am. I decided to run the command.
$ gem install rails
then I installed gems:
$ gem install rubygems-update
and finally tested the environment with: rails new blog command.
Until here all seems to be working fine, but I am following the ruby guides in order to start coding my project. I don't have RVM now so I don't know how to handle with upgrades and versions.
That is my only problem, because I was told that Rails change frequently.
I would like to know now how to handle with upgrades including gems.

Problem Using Ruby Version Manager (RVM) on Mac

I just started reading Michael Hartl's Ruby on Rails 3 Tutorial. He recommends using the latest version of Ruby, currently 1.9.2. My Mac, an original Intel iMac now running Snow Leopard, has Ruby 1.8.7 installed.
Michael suggests installing the latest versions of Ruby and and Rails using the Ruby Version Manager (RVM). So I went to the RVM site and installed RVM with...
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
It seemed to work. A message popped up in the Terminal thanking me for using RVM.
Following Michael's next instruction, which is to make sure RVM is current:
rvm update --head
which results in -bash: rvm: command not found
A footnote suggests that I might need to install Subversion, so installed it, but I still get the same error message when I run rvm update --head.
Any suggestions? I'd really like to move beyond setup and get to building my Rails app.
rvm also gave a message after install saying you needed to add a line to your ~/.bashrc (or equivalent):
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
do that, and then type . ~/.bashrc or open a new terminal.

Resources