Ruby settings 1

at first

Confirmation

(m ・_・ Bp) mbp-2 17:04 ~ % ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]

Various installations

$ brew install openssl
$ brew install readline
$ brew install libyaml
$ brew install autoconf

ruby-build ruby-build is a plugin of rbenv that automatically builds ruby.

$ brew update
$ brew upgrade ruby-build

$ ruby-build --version

Check the current version

## .rbenv install
```bash
 (m ・ _ ・ bp) mbp-2 17:10 ~% brew install rbenv ruby-build

/etc/Moved to add to zprofile

 (m ・ _ ・ bp) mbp-2 17:12 ~% cd / etc
 (m ・ _ ・ bp) mbp-2 17:16 / etc% sudo cp zprofile zprofile.org # Make a spare just in case
 (m ・ _ ・ bp) mbp-2 17:16 / etc% sudo vi zprofile

##Add the following to rbenv PATH zprofile

if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

 (m ・ _ ・ bp) mbp-2 18:06 ~% source / etc / zprofile

##rbenv install confirmation

 (m ・ _ ・ bp) mbp-2 17:22 ~% rbenv -v
rbenv 1.1.2

ruby-build install,,,Already installed

 (m ・ _ ・ bp) mbp-2 17:35 ~% brew install ruby-build
Warning: ruby-build 20200401 is already installed and up-to-date
To reinstall 20200401, run `brew reinstall ruby-build`

##Install the latest version with rbenv

 (m ・ _ ・ bp) mbp-2 17:22 ~% rbenv versions
* system (set by /Users/uekiyoshihiro/.rbenv/version)

##Install with rbenv Ruby official website See this site and install the latest stable version

 ~ % rbenv install -l

 ~ % rbenv install 2.7.1

 ~ % ruby -v

 ~ % rbenv install 2.6.5

##Switch ruby version There are two types of version switching: directory-only settings or default settings.

 $ rbenv local <version>
# Change the version of ruby used under the executed directory
# The specified version of .ruby-version is created

 $ rbenv global <version>
# Change the version of ruby used by default

$ rbenv local --unset
# Cancel local version specification

As mentioned above, if you want to use a different version of ruby for each application, in each directoryrbenv localExecute and specify the ruby version.

By the way, when you execute these commands, it will change to the current directory..ruby-A file called "version" is created. This changes the version of ruby used automatically.

##Other: openssl openssl is a package for using https.

$ which openssl
$ brew list openssl
$ openssl version

reference:Introduced rbenv to Mountain Lion

 (m ・ _ ・ bp) mbp-2 19:48 ~% rbenv versions
  system
  2.6.5
  2.6.6
* 2.7.1 (set by /Users/uekiyoshihiro/.ruby-version)



 (m ・ _ ・ bp) 14:57 ~ / Desktop / vsnote2.0 / ruby / lib / rubybook_2% gem install minitest -v 5.10.1
Fetching minitest-5.10.1.gem
Successfully installed minitest-5.10.1
Parsing documentation for minitest-5.10.1
Installing ri documentation for minitest-5.10.1
Done installing documentation for minitest after 0 seconds
1 gem installed

Recommended Posts

Ruby settings 1
Ruby learning 4
RuboCop settings
[Ruby] Array
Ruby basics
Ruby learning 5
Ruby basics
Refactoring Ruby
Ruby learning 3
Ruby setting 2
Ruby learning 2
Refactoring Ruby
ruby calculator
Ruby learning 6
Refactoring Ruby
Ruby basics
Ruby memo
Ruby learning 1
Ruby Review 1
[Ruby] Module
Ruby Gem Code Reading settings logic Part 1
Validation settings for Ruby on Rails login function
Introduction to Ruby 2
ruby Uppercase letters
ruby search problem
Ruby Learning # 25 Comments
Ruby to_s method
[Ruby] postfix if
[Ruby] FizzBuzz problem
CentOS8 bind settings
Eclipse formatter settings
Ruby text conversion
Ruby basic terms
ruby exception handling
Ruby Learning # 13 Arrays
About Ruby symbols
Ruby Learning # 1 Introduction
Ruby Learning # 34 Modules
[ruby] drill output
I started Ruby
[Ruby] Iterative processing
ruby API problem
Ruby vertical writing
About ruby ​​form
[ruby] drill output
Ruby Learning # 14 Hashes
[ruby] drill output
[Ruby] each nested
[Ruby] FizzBuzz problem
Ruby Hash notes
centos7 Initial settings
Class in Ruby
[Ruby] slice method
Ruby standard output
[Ruby] end_with? method
[Ruby] Method memorandum
Chart type Ruby
[Ruby] Hash retrieval
[WIP] Ruby Tips
[ruby] drill output
Ruby exception handling