Меню Рубрики

Update ruby mac os

How to update Ruby Version 2.0.0 to the latest version in Mac OSX Yosemite?

I need to update my ruby version from 2.0.0 to the latest version, I can not use some gems because my version is not updated. I had used Homebrew to install Ruby some time ago, How can i update my Ruby version?

11 Answers 11

Open your terminal and run

When this is complete, you need to restart your terminal for the rvm command to work.

Now, run rvm list known

This shows the list of versions of the ruby.

Now, run rvm install ruby@latest to get the latest ruby version.

If you type ruby -v in the terminal, you should see ruby X.X.X .

If it still shows you ruby 2.0. , run rvm use ruby-X.X.X —default .

Brew only solution

Update:

From the comments (kudos to Maksim Luzik), I haven’t tested but seems like a more elegant solution:

After installing ruby through brew, run following command to update the links to the latest ruby installation: brew link —overwrite ruby

Original answer:

Late to the party, but using brew is enough. It’s not necessary to install rvm and for me it just complicated things.

By brew install ruby you’re actually installing the latest (currently v2.4.0). However, your path finds 2.0.0 first. To avoid this just change precedence (source). I did this by changing

/.profile and setting:

After this I found that bundler gem was still using version 2.0.0, just install it again: gem install bundler

/.bash_profile» after install – mjpablo23 Aug 15 ’17 at 18:51

rbenv does…

  • Provide support for specifying application-specific Ruby versions.
  • Let you change the global Ruby version on a per-user basis.
  • Allow you to override the Ruby version with an environment variable.

In contrast with RVM, rbenv does not…

  • Need to be loaded into your shell. Instead, rbenv’s shim approach works by adding a directory to your $PATH .
  • Override shell commands like cd or require prompt hacks. That’s dangerous and error-prone.
  • Have a configuration file. There’s nothing to configure except which version of Ruby you want to use.
  • Install Ruby. You can build and install Ruby yourself, or use ruby-build to automate the process.
  • Manage gemsets.Bundler is a better way to manage application dependencies. If you have projects that are not yet using Bundler you can install the rbenv-gemset plugin.
  • Require changes to Ruby libraries for compatibility. The simplicity of rbenv means as long as it’s in your $PATH , nothingelse needs to know about it.

INSTALLATION

Install Homebrew http://brew.sh

UPDATE
There’s one additional step after brew install rbenv Run rbenv init and add one line to .bash_profile as it states. After that reopen your terminal window […] SGI Sep 30 at 12:01 —https://stackoverflow.com/users/119770

Set the global version:

Set the local version of your repo by adding .ruby-version to your repo’s root dir:

Источник

Update Ruby to Latest Version on Mac OS X

I recently needed to do a small scripting job in Ruby, and to use the gems required I needed to be on the latest version of Ruby (2.4.1). My MacBook was on an older version, so I needed to run a quick update. Here is the process I followed:

1. Check the version of Ruby installed on your Mac

Open terminal and type:

2. Install the Ruby Version Manager rvm

In terminal, curl -L https://get.rvm.io | bash -s stable

Once this command has finished running you may need to restart your terminal for rvm to be recognised.

3. Install the latest version of Ruby

rvm install ruby-[version]

In my case this was

rvm install ruby-2.4.1

This took a while to run as it had to install a lot of dependencies and asked for my permission a couple of times.

4. Set the latest version of Ruby as the one you want to use

You should now be running the latest version of Ruby. You can check as before with the ruby -v command as in step 1. If you’re find that you’re not, you can set this manually. In terminal type:

If you want to set this latest version of Ruby as the default version, in terminal type:

rvm —default use 2.4.1

Don’t forget to replace 2.4.1 with the version number of your latest Ruby.

Источник

Do you need to update Ruby manually on a Mac?

Ruby comes automatically installed on OS X. I assume when you get a new Mac it comes with the latest stable release of Ruby. Do you have to update it yourself manually over time, or does it get upgraded automatically when you upgrade your OS?

2 Answers 2

I assume when you get a new Mac it comes with the latest stable release of Ruby.

No, it comes with whatever release Apple felt confident to support for the lifetime of the OS release.

Do you have to update it yourself manually over time, or does it get upgraded automatically when you upgrade your OS?

Those two are not mutually exclusive.

Yes, it does get upgraded automatically, in order to, e.g., patch security vulnerabilities. However, an OS vendor will generally avoid updating anything they ship as part of the OS as much as possible, since they generally guarantee backwards-compatibility, and the easiest way to guarantee backwards-compatibility for third-party code that you have no control over, is to just not change it.

For example, macOS 10.14.6, which is the current release of macOS and was released 4 weeks ago, ships with Ruby 2.3.7, which was released 18 months ago.

The last release of Ruby 2.3 was Ruby 2.3.8, and the Ruby developers stopped providing security patches to Ruby 2.3 6 months ago. (Note that Apple does still provide security patches for Ruby 2.3 as part of macOS, though.)

Источник

How to update Ruby with Homebrew?

I want to know how to update to the latest stable version of Ruby with Homebrew. I am not interested in using RVM. Thanks.

5 Answers 5

Should pull latest version of the package and install it.

brew update updates brew itself, not packages (formulas they call it)

I would use ruby-build with rbenv . The following lines install Ruby 2.7.1 and set it as your default Ruby version:

/.bash_profile – guya Sep 10 ’16 at 23:54

Adding to the selected answer (as I haven’t enough rep to add comment), one way to see the list of available versions (from ref) try:

To upgrade Ruby with rbenv: Per the rbenv README

  • Update first: brew upgrade rbenv ruby-build
  • See list of Ruby versions: versions available: rbenv install -l
  • Install: rbenv install

Источник

How to update system Ruby to 1.9.2 on Mac?

I saw an answer saying I should use RVM. But I don’t know how even after:

5 Answers 5

The title of the question, «How to update system Ruby to 1.9.2 on Mac» makes me wonder if you are trying to upgrade Apple’s installation of Ruby 1.8.7 to 1.9.2. If that is true, STOP and do NOT try that. The Ruby installed by Apple is for their use, and apps installed by Apple use it.

will list the reasons why.

RVM and other apps allow you to install Ruby safely, so unless you have very good knowledge of how Unix and the Mac work I strongly recommend you stick to them.

A very common problem we see is that the installation wasn’t completed. Read the «Installation» section in the RVM installation page to double-check you’ve completed everything.

To install Ruby 1.9.2 do:

and read and install the needed dependencies. Then do:

will tell RVM to always use 1.9.2 as a default. You can switch to the system version installed by Apple using:

and switch back using

If you don’t want an RVM-based solution:

  1. Download and install Apple’s Xcode developer tools so you get GCC et al, the ability to build your own software. (This is 4.25GB, but you only need to download it once.)
  2. Download and extract the Ruby Source Code. (10.6MB)
  3. Open a Terminal window and change into the directory of the source code.
  4. Run the command ./configure && make ; get a cup of tea while you wait
  5. Run the command sudo make install to install this Ruby; you’ll need to supply your administrator password
  6. Modify your PATH environment variable to put /usr/local/bin in front of /usr/bin (so that your new Ruby is found before the system Ruby). You can do this by creating or editing a .profile file in your home directory to have the line:
    export PATH=»/usr/local/bin::$PATH»
    • If you’re running TextMate, you’ll also want to go to TextMate ▸ Preferences ▸ Advanced ▸ Shell Variables
      and add or edit a PATH variable like this:
      /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

After this, rvm use system will use your 1.9.2p180 (the current version as of this post) install.

I’m assuming you’re not sure how to install a new version of ruby with RVM — try:

To then make it the default version to use:

Consider also: «for OS X try using RailsInstaller for OS X or try the official RVM GUI JewelryBox» — Quoted from from the 4rd or 5th screen the RVM install page found here http://rvm.io/rvm/install

Whatever you do do not touch or mess with the system default Ruby that ships with your Mac I did that to see what would and my system was out of whack. If you would like to use a different version of Ruby use rvm.

Not the answer you’re looking for? Browse other questions tagged ruby macos system rvm or ask your own question.

Related

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2020.9.18.37632

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

  • Update management tool mac os
  • Untrusted cert title mac os sierra
  • Unreal tournament для mac os
  • Unreal tournament 1999 mac os
  • Unix linux mac os