(m ・_・ Bp) mbp-2 17:04 ~ % ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
$ 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
## .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
(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 local
Execute 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