LoginSignup
3
5

More than 5 years have passed since last update.

どうしてもhomebrew,rbenvからrubyをインストールできない場合

Last updated at Posted at 2018-03-26

これから素敵なrubyライフを送ろうとして、イントールに手間取ってしまい、その回避方法の記述をあまり見受けられなかったので、投稿いたします。

現象

rbenvのインストールまでは行えるが、rubyのインストールでBUILD FAILEDとなる。

各種コマンド
# homebrewのインストール
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# rbenvのインストール
brew install rbenv

# rubyのインストール <- ここでエラー
# (-vオプションでエラー内容を出力するとわかりやすい)
rbenv install 2.3.5 -v
エラー内容
ruby-build: use openssl from homebrew
Downloading ruby-2.3.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.5.tar.bz2
Installing ruby-2.3.5...
curl: (4) Unsupported proxy scheme for 'https://xxx.xxx.xxx.xxx:80' :libcurl is built without the HTTPS-proxy support

BUILD FAILED (OS X 10.12.3 using ruby-build 20170201)

プロキシの問題でダウンロードできない状態の様子。
curl自体にhttpsプロキシの設定ができないことから生じるらしいので、~/.curlrcを確認するもhttpのプロキシのみしか設定していない・・・

解決(根本ではない)

rbenvでrubyのダウンロードが遅い時の対処法を参考に直接、ダウンロードしてみる。
どうやらchacheディレクトリに圧縮ファイルをダウンロードすればrubyのインストールができるらしい。
1.~/rbenvにcacheディレクトリを作成・移動
# mkdir ~/.rbenv/chache
# cd ~/.rbenv/chache
2.対象圧縮ファイルのダウンロード
参考サイトでは、ミラーサイトのrubyだったため、筆者もミラーサイトからダウンロードしてみたところ成功。
# curl -O https://ftp.ruby-lang.org/pub/ruby/2.3/ruby-2.3.5.tar.gz
3.rbenv install 2.3.5
無事インストールされる

疑問

直接curlコマンドを打つとプロキシに引っかからないのは一体・・・

原因調査

rubyのインストールに関して、原因調査を行なった内容。役立つかもしれないので記載。

brew doctor

homebrew自体に問題がないか確認
Warning: You have a curlrc fileと出るも問題ないとのこと

brew info

brew infoコマンドを実行すると仮ビルドをして内容を出力してくれるので、Dependenciesなどに記載されているものが無事にbuildされるか確認(チェックマークなら問題なし)。なければインストールしてみる。

brew info rbenv
rbenv: stable 1.1.1 (bottled), HEAD
Ruby version manager
https://github.com/rbenv/rbenv#readme
/usr/local/Cellar/rbenv/1.1.1 (36 files, 62.9KB) *
  Poured from bottle on 2018-03-23 at 08:52:47
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/rbenv.rb
==> Dependencies
Recommended: ruby-build ✔
==> Options
--without-ruby-build
    Build without ruby-build support
--HEAD
    Install HEAD version
3
5
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
3
5