1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Rubyローカル環境構築:Homebrew、rbenv、ruby-buildを使った構築方法

Last updated at Posted at 2020-02-23

概要

ここではHomebrewのインストールについて記載する。
作業で必要になったので、メモを兼ねて記載。

環境

Mac OS Catalina 10.15

前提

・Xcodeのインストール
・Command Line Toolsのインストール(xcode-select --install)

インストール

1.Homebrewをコマンドラインでインストールする

ターミナルで以下を記載して実行する

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
HEAD is now at 8a5e32ccc Merge pull request #7663 from MikeMcQuaid/external-man
Updated 1 tap (homebrew/core).
==> Updated Formulae
imagemagick ✔    atlantis         gatsby-cli       imagemagick@6    node-sass        onnxruntime      picard-tools
acpica           evince           hlint            mu               nss              pandoc-crossref  stellar-core
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (or will be during this `install` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run `brew help` to get started
- Further documentation:
    https://docs.brew.sh

Installation successfulと表示され、インストールが成功する

2.Homebrewを最新にする

$ brew upgrade

3.rbenvのインストール

$ brew install rbenv
$ echo 'eval "$(rbenv init -)"' >> ~/.zshrc
$ source ~/.zshrc

4.Rubyのインストールと利用設定

$ ]$ rbenv install 2.6.6
Downloading openssl-1.1.1g.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
Installing openssl-1.1.1g...
Installed openssl-1.1.1g to /Users/mem/.rbenv/versions/2.6.6

Downloading ruby-2.6.6.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.bz2
Installing ruby-2.6.6...
ruby-build: using readline from homebrew
Installed ruby-2.6.6 to /Users/mem/.rbenv/versions/2.6.6

インストール後、標準で利用するRubyのバージョンを2.6.6にする。

$ rbenv global 2.6.6

ターミナルでRubyのバージョンを確認する。

$ ruby -v
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]

変更履歴

日付 内容
2020/05/31 マシン環境の変更(zshに対応)とRubyバージョン更新により、方法の一部変更
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?