Mac os установить rvm

∞Installing RVM

RVM supports most UNIX like systems and Windows (with Cygwin or Bash on Ubuntu on Windows). The basic requirements are bash , curl , gpg2 and overall GNU version of tools — but RVM tries to autodetect it and install anything that is needed.

∞Install GPG keys

As a first step install GPG keys used to verify installation package:

In case you encounter an issues check security

∞Basic install

∞Ubuntu

RVM have dedicated Ubuntu package, so please follow instructions posted here: https://github.com/rvm/ubuntu_rvm

If you need a different (newer) version of RVM, after installing base version of RVM check the Upgrading section.

∞Any other system

Install RVM (development version):

Install RVM stable with ruby:

Additionally with rails (poor man’s railsinstaller):

Or with jruby, rails and puma:

To install without rubygems-bundler and rvm gems (and also remove those gems from both global.gems and default.gems):

To install with hirb gem (and also add it to global.gems):

To install with rails and haml gems (and also add them to default.gems):

For a progress bar when downloading RVM / Rubies:

Point to be noted is, there is a backslash before curl. This prevents misbehaving if you have aliased it with configuration in your

If you’re an existing RVM user and you don’t want RVM to attempt to setup your shell to load RVM, you can opt out of this at install time by exporting rvm_ignore_dotfiles=yes, or opt out permanently by setting this in your rvmrc.

∞You can also:

  • read the installation documentation below.
  • watch the most accurate (but not official) rvm screencast.
  • read the most accurate (but not official) rvm cheat sheet.
  • starting with Rails? watch the RailsCasts.com on Getting Started with Rails.

∞Installation explained

There are three different ways to install and configure RVM.

  1. Single-User installations ( recommended ) — For an isolated install within a user’s $HOME, not for root.
  2. Multi-User installations — For server administrators — For an installation usable by all users on the system — Please note that Single-User supersedes Multi-User. This also used to be called the System-Wide Install. Using this type of installation without knowledge how umask works is a big security risk.
  3. Mixed mode installations — For an installation usable by all users on the system — with isolated rubies/gemsets within a user’s $HOME. Installation instructions are exactly the same as for Multi-User installations, the difference is in users environment.

∞Installation

I recommend you read the installation script yourself. This will give you a chance to understand what it is doing before installing, and allow you to feel more comfortable running it if you do so.

∞1. Download and run the RVM installation script

Installing the stable release version:

To get the latest development state:

Instruct RVM to not change the shell initializations files ‘rc’ / ‘profile’:

Please note that from this point it is user responsibility to add sourcing rvm to appropriate files.

For a Multi-User install you would execute the following:

Note: The Multi-User install instructions must be prefixed with the sudo command. However, once the install is complete, and the instructions to add users to the rvm group is followed, the use of either sudo or rvmsudo is no longer required. The sudo command is only to temporarily elevate privileges so the installer can complete its work. If you need to use sudo or rvmsudo after the install is complete, some part of the install directions were not properly followed. This usually is because people execute the install as root , rather than executing the installation instructions from a non-privileged user account.

Читайте также:  Как удалить драйвер принтера с компьютера windows 10

Installing a specific version:

Prefix the ‘bash’ portion with ‘sudo’, of course, if you wish to apply this to a Multi_user Install. Please feel free to check out our upgrading docs for more details on branch format.

Debugging installation process:

If the rvm install script complains about certificates you need to follow the displayed instructions.

Single-User Install Location:

If the install script is run as a standard, non-root user, RVM will install into the current users’s home directory.

Modification of user configuration files ( *rc / *profile ) — RVM by default will modify user startup files, although it is not recommended you can disable automated process and do this manually:

Multi-User Install Location: /usr/local/rvm

If the install script is run prefixed with sudo, RVM will automatically install into /usr/local/rvm . Please see the troubleshooting page for an important note regarding Multi-User Installs.

Please see the FAQ page for an important note regarding root only installs.

External tutorials

Note that that any outside tutorials are NOT supported whether they work or not. Tutorials are great, however we have spent massive amounts of man hours debugging the installation process. Please use the install process(es) from this site only, as this is the only supported installation types and methods.

To update an existing RVM installation

It is safe to simply re-run the installation script again, or you can follow the upgrading docs.

∞2. Load RVM into your shell sessions as a function

Single-User:

The rvm function will be automatically configured for every user on the system if you install as single user. Read the output of installer to check which files were modified.

Multi-User:

The rvm function will be automatically configured for every user on the system if you install with sudo. This is accomplished by loading /etc/profile.d/rvm.sh on login. Most Linux distributions default to parsing /etc/profile which contains the logic to load all files residing in the /etc/profile.d/ directory. Once you have added the users you want to be able to use RVM to the rvm group, those users MUST log out and back in to gain rvm group membership because group memberships are only evaluated by the operating system at initial login time. Zsh not always sources /etc/profile so you might need to add this in /etc/**/zprofile :

Mixed mode (user gemsets):

  • After following above instructions for Multi-User.
  • Select a user as a manager — he will be responsible for installing new rubies. This user should never run the command introduced below. If this happens, remove/rename the $/.rvmrc , logout and then relogin. Otherwise you won’t be able to install/upgrade new rubies correctly.

For each user that want to use RVM, an additional command needs to be run (once) for each user:

Gemsets created by these users will be hosted in their HOME directory. It’s not possible to use global gemsets from system without using tricks like manually linking directories and they should not be used in mixed-mode. Please bear in mind that ‘system’ in this context does not refer to your distribution’s ruby packages, but to the RVM Multi-User installation.

You have two possibilities to manage RVM. The first one is to add managers to the rvm group. The second one is to use separate managers with rvmsudo and privilege escalation. Note that it is not safe to use rvmsudo from mixed mode user. Both can be mixed without any side-effect. It is however very important to not enable mixed-mode gemsets or rubies for the managers. RVM is using a custom umask ( umask u=rwx,g=rwx,o=rx ) when installing gemsets, rubies, updating itself, etc. This should not impact your system. But if you prefer to avoid RVM messing around with your umask, you can comment the umask line in /etc/rvmrc .

This mode should also works with passenger, please follow passenger instructions. .

∞3. Reload shell configuration & test

Close out your current shell or terminal session and open a new one (preferred). You may load RVM with the following command:

If installation and configuration were successful, RVM should now load whenever you open a new shell. This can be tested by executing the following command which should output rvm is a function as shown below.

NOTE: Before reporting problems check rvm notes as it might contain important information.

Congratulations! You have successfully installed RVM.

∞Try out your new RVM installation

Below are some examples of how to install and use a Ruby under RVM.

Display a list of all known rubies. NOTE: RVM can install many more Rubies not listed.

Install a version of Ruby (eg 2.1.1 ):

Use the newly installed Ruby:

Check this worked correctly:

Optionally, you can set a version of Ruby to use as the default for new shells. Note that this overrides the ‘system’ ruby:

∞Enjoy using RVM!

∞Where to now?

If you are new to RVM I recommend that you read the basics page. At the end of the basics page there are further links for getting started.

∞Troubleshooting Your Install

and got the notice

ca-certificates need to be installed:

If you open a new shell and running:

does not show rvm is a function , RVM isn’t being sourced correctly.

Ensure that RVM is sourced after any path settings as RVM manipulates the path. If you don’t do this, RVM may not work as expected.

If you are using GNOME on Red Hat, CentOS or Fedora, ensure that the Run command as login shell option is checked under the Title and Command tab in Profile Preferences. After changing this setting, you may need to exit your console session and start a new one before the changes take affect.

Источник

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 ).

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.

Источник

Читайте также:  Установка gnu grub windows
Оцените статью