Mac os updating ruby

Installing Ruby

With package managers or third-party tools, you have plenty of options to install and manage Ruby.

You may already have Ruby installed on your computer. You can check inside a terminal emulator by typing:

This should output some information on the installed Ruby version.

Choose Your Installation Method

There are several ways to install Ruby:

  • On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one.
  • Installers can be used to install a specific or multiple Ruby versions. There is also an installer for Windows.
  • Managers help you to switch between multiple Ruby versions on your system.
  • Finally, you can also build Ruby from source.

On Windows 10, you can also use the Windows Subsystem for Linux to install one of the supported Linux distributions and use any of the installation methods available on that system.

Here are available installation methods:

Package Management Systems

If you cannot compile your own Ruby, and you do not want to use a third-party tool, you can use your system’s package manager to install Ruby.

Some members of the Ruby community feel that you should avoid package managers to install Ruby and that you should use dedicated tools instead.

It is possible that major package managers will install older Ruby versions instead of the latest release. To use the latest Ruby release, check that the package name matches its version number. Or use a dedicated installer.

apt (Debian or Ubuntu)

Debian GNU/Linux and Ubuntu use the apt package manager. You can use it like this:

yum (CentOS, Fedora, or RHEL)

CentOS, Fedora, and RHEL use the yum package manager. You can use it like this:

The installed version is typically the latest version of Ruby available at the release time of the specific distribution version.

snap (Ubuntu or other Linux distributions)

Snap is a package manager developed by Canonical. It is available out-of-the-box on Ubuntu, but snap also works on many other Linux distributions. You can use it like this:

We have several channels per Ruby minor series. For instance, the following commands switch to Ruby 2.3:

portage (Gentoo)

Gentoo uses the portage package manager.

To install a specific version, set RUBY_TARGETS in your make.conf . See the Gentoo Ruby Project website for details.

pacman (Arch Linux)

Arch Linux uses a package manager named pacman. To get Ruby, just do this:

This should install the latest stable Ruby version.

Homebrew (macOS)

Ruby versions 2.0 and above are included by default in macOS releases since at least El Capitan (10.11).

Homebrew is a commonly used package manager on macOS. Installing Ruby using Homebrew is easy:

This should install the latest Ruby version.

FreeBSD

FreeBSD offers both pre-packaged and source-based methods to install Ruby. Prebuilt packages can be installed via the pkg tool:

A source-based method can be used to install Ruby using the Ports Collection. This is useful if you want to customize the build configuration options.

More information about Ruby and its surrounding ecosystem on FreeBSD can be found on the FreeBSD Ruby Project website.

OpenBSD

OpenBSD as well as its distribution adJ has packages for the three major versions of Ruby. The following command allows you to see the available versions and to install one:

You can install multiple major versions side by side, because their binaries have different names (e.g. ruby27 , ruby26 ).

Читайте также:  Настраиваем windows 10 ltsc

The HEAD branch of the OpenBSD ports collection might have the most recent version of Ruby for this platform some days after it is released, see directory lang/ruby in the most recent ports collection.

Ruby on OpenIndiana

To install Ruby on OpenIndiana, please use the Image Packaging System (IPS) client. This will install the Ruby binaries and RubyGems directly from the OpenIndiana repositories. It’s easy:

However, the third-party tools might be a good way to obtain the latest version of Ruby.

Windows Package Manager

On Windows, you can use the Windows Package Manager CLI to install Ruby:

Other Distributions

On other systems, you can search the package repository of your Linux distribution’s manager for Ruby. Alternatively, you can use a third-party installer.

Installers

If the version of Ruby provided by your system or package manager is out of date, a newer one can be installed using a third-party installer.

Some installers allow you to install multiple versions on the same system; associated managers can help to switch between the different Rubies.

If you are planning to use RVM as a version manager you don’t need a separate installer, it comes with its own.

ruby-build

ruby-build is a plugin for rbenv that allows you to compile and install different versions of Ruby. ruby-build can also be used as a standalone program without rbenv. It is available for macOS, Linux, and other UNIX-like operating systems.

ruby-install

ruby-install allows you to compile and install different versions of Ruby into arbitrary directories. chruby is a complimentary tool used to switch between Ruby versions. It is available for macOS, Linux, and other UNIX-like operating systems.

RubyInstaller

On Windows, RubyInstaller gives you everything you need to set up a full Ruby development environment.

Just download it, run it, and you are done!

Ruby Stack

If you are installing Ruby in order to use Ruby on Rails, you can use the following installer:

  • Bitnami Ruby Stack provides a complete development environment for Rails. It supports macOS, Linux, Windows, virtual machines, and cloud images.

Managers

Many Rubyists use Ruby managers to manage multiple Rubies. They allow easy or even automatic switching between Ruby versions depending on the project and other advantages but are not officially supported. You can however find support within their respective communities.

asdf-vm

asdf-vm is an extendable version manager that can manage multiple language runtime versions on a per-project basis. You will need the asdf-ruby plugin (which in turn uses ruby-build) to install Ruby.

chruby

chruby allows you to switch between multiple Rubies. It can manage Rubies installed by ruby-install or even built from source.

rbenv

rbenv allows you to manage multiple installations of Ruby. While it can’t install Ruby by default, its ruby-build plugin can. Both tools are available for macOS, Linux, or other UNIX-like operating systems.

RVM (“Ruby Version Manager”)

RVM allows you to install and manage multiple installations of Ruby on your system. It can also manage different gemsets. It is available for macOS, Linux, or other UNIX-like operating systems.

Uru is a lightweight, multi-platform command line tool that helps you to use multiple Rubies on macOS, Linux, or Windows systems.

Building from Source

Of course, you can install Ruby from source. Download and unpack a tarball, then just do this:

By default, this will install Ruby into /usr/local . To change, pass the —prefix=DIR option to the ./configure script.

You can find more information about building from source in the Ruby README file.

Using the third-party tools or package managers might be a better idea, though, because the installed Ruby won’t be managed by any tools.

Источник

Can I upgrade to the current version of Ruby (2.2.3) on OS X v10.6.8?

I’m looking at «Install Ruby on Rails · Mac OS X Yosemite», and in the instructions it says to update your OS which I don’t really want to do because my computer is getting old.

I also found «How to update Ruby to 1.9.x on Mac?». As far as I can tell, I don’t have RVM and I’m afraid of yet another install, in case my system requirements still aren’t good enough.

Ultimately, I’m trying to update Jekyll, but I need to update my system a little bit first. I need Ruby 1.9.3 or later. Will «How to update Ruby to 1.9.x on Mac?» work? I’m running Ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin10.0]’.

Читайте также:  Kaspersky для windows 10 home

EDIT: I did end up getting RVM installed. For those who find this page in the future, I ran into these issues/help pages:

/.profile’ file.

  • RVM installation missing $PATH * WARNING: Above files contains PATH= with no $PATH inside
  • 4 Answers 4

    I suggest that you use RVM to install Ruby.

    You need to restart the terminal in order to run rvm:

    This is what worked for me

    For the most up-to-date info on how to do this, check this documentation.

    You do not need the latest version of OSX to run an updated version of Ruby. Whether or not you need something more current than 10.6.8 to run 2.2.3 I cannot tell. But 1.9.3 should build just fine and 2.2.3 likely will as well.

    Using rvm (or rbenv , or ruby-build , or whatever) is certainly an option if you are simply doing development. Then you can have multiple ruby versions at your command without having to disturb the system ruby. Be aware these are not a panacea. Each has its own complexities and egocentricities. Go to the project websites and read the documentation carefully or you can easily get betrayed by your assumptions about how things ‘should’ work.

    All of ruby version managers should install on any version of OSX that supports the build tools required by the Ruby that you want to host. However, be aware you will need installed the OSX xcode application for your system (available free from the Apple App Store but you need an account) and you will need the optional command line tools for xcode as well (also from the App Store).

    If you want to update the system ruby then take a look at either the homebrew or macports projects. These provide up to date versions of many, many linux projects for OSX, including Ruby (and git). You will need to meet the same xcode requirements. A build is a build wherever the binaries end up.

    The system from which I am writing this answer once ran Snow Leopard and I had at least Ruby 1.9 dot something installed on it via Ports. I am currently paused at 10.9.5 and am running:

    Источник

    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

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

    brew upgrade ruby

    Should pull latest version of the package and install it.

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

    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

    \curl -sSL https://get.rvm.io | bash -s stable

    restart terminal then

    check ruby version it should be 2.4.2

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

    Linked

    Hot Network Questions

    Subscribe to RSS

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

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

    By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

    Источник

    How to update Ruby to 1.9.x on Mac?

    I have created a new user account on my mac and I am trying to update to the current version of ruby on it (1.9.2) from the snow leopard default of 1.8.7. Can somebody point me to tutorial or explain the best method to update Ruby on my mac from 1.8 to 1.9.2? Thanks

    9 Answers 9

    As The Tin Man suggests (above) RVM (Ruby Version Manager) is the Standard for upgrading your Ruby installation on OSX: https://rvm.io

    To get started, open a Terminal Window and issue the following command:

    ( you will need to trust the RVM Dev Team that the command is not malicious — if you’re a paranoid penguin like me, you can always go read the source: https://github.com/wayneeseguin/rvm ) When it’s complete you need to restart the terminal to get the rvm command working.

    Читайте также:  Обзор браузера brave для windows

    ( shows you the latest available versions of Ruby )

    For a specific version, followed by

    or if you just want the latest (current) version:

    ( installs the current stable release — at time of writing ruby-2.3.1 — please update this wiki when new versions released )

    Note on Compiling Ruby: In my case I also had to install Homebrew http://mxcl.github.com/homebrew/ to get the gems I needed (RSpec) which in turn forces you to install Xcode (if you haven’t already) https://itunes.apple.com/us/app/xcode/id497799835 AND/OR install the GCC package from: https://github.com/kennethreitz/osx-gcc-installer to avoid errors running «make«.

    Edit: As of Mavericks you can choose to install only the Xcode command line tools instead of the whole Xcode package, which comes with gcc and lots of other things you might need for building packages. It can be installed by running xcode-select —install and following the on-screen prompt.

    Note on erros: if you get the error «RVM is not a function» while trying this command, visit: How do I change my Ruby version using RVM? for the solution.

    Источник

    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 .

    Prerequisites for windows 10:

    • C compiler. You can use http://www.mingw.org/
    • make command available otherwise it will complain that «bash: make: command not found». You can install it by running mingw-get install msys-make
    • Add «C:\MinGW\msys\1.0\bin» and «C:\MinGW\bin» to your path enviroment variable

    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

    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:

    Источник

    Оцените статью