amasok's blog

Articles tagged 'ruby'

The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

2013/12/02 23:48 tags: ruby, rbenv, このエントリーをはてなブックマークに追加

2.0以上のrubyをrbenvでインストールしようとすると出るっぽいエラーの対処

The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

↑CentOS6.4こrubyをrbenv使ってインストールしようとしたらこのようなエラーが出ました。

エラー文

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ rbenv install 2.0.0-p353 Downloading ruby-2.0.0-p353.tar.gz... -> http://dqw8nmjcqpjn7.cloudfront.net/78282433fb697dd3613613ff55d734c1 Installing ruby-2.0.0-p353... BUILD FAILED Inspect or clean up the working tree at /tmp/ruby-build.20131201141930.25356 Results logged to /tmp/ruby-build.20131201141930.25356.log Last 10 log lines: installing default gems: /usr/local/rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0 \ (build_info, cache, doc, gems, specifications) bigdecimal 1.2.0 io-console 0.4.2 json 1.7.7 minitest 4.3.2 psych 2.0.0 rake 0.9.6 rdoc 4.0.0 test-unit 2.0.0.0 The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

対処

OpenSSLのライブラリですがせっかくなのでCenctOSとUbuntu両方乗っけときます。

CentOS

1
$ sudo yum -y install openssl-devel

Ubuntu

1
$ sudo apt-get -y install libssl-dev

これでエラー解消です。 ちょこっと焦りました。

rubyをrbenvで入れる

2013/11/29 00:34 tags: rbenv, ruby, このエントリーをはてなブックマークに追加

bundleをちゃんとするようになったら、ローカルがgemだらけなのが嫌になったので一から入れ直しました。 今回はrubyの導入を説明しようかと思います。

対象

  • homebrewを使ってる人
  • rubyをrbenvでバージョン管理したい人

実行環境

  • Mac(Mountain Lion)

方法

まずはbrewで必要なものをインストールします

terminal

1
2
$ brew install rbenv $ brew install ruby-build

ホームディレクトリでディレクトリ作成

terminal

1
2
$ cd ~ #ホームディレクトリへ $ mkdir .rbenv

下記内容を.bash_profileに追記

.bash_profile

1
2
export PATH="$HOME/.rbenv/bin:$PATH" eval "$(rbenv init -)"

.bash_profileを再読み込み

terminal

1
$ source ~/.bash_profile

rubyのインストールできるリストを確認

terminal

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$ rbenv install -l Available versions: . . . 1.9.3-p125 1.9.3-p194 1.9.3-p286 1.9.3-p327 1.9.3-p362 1.9.3-p374 1.9.3-p385 1.9.3-p392 1.9.3-p429 1.9.3-p448 1.9.3-p484 1.9.3-preview1 1.9.3-rc1 2.0.0-dev 2.0.0-p0 2.0.0-p195 2.0.0-p247 2.0.0-p353 2.0.0-preview1 2.0.0-preview2 2.0.0-rc1 . . .

このようにリストがずらっと並ぶので、入れたいバージョンを指定してインストールします。

terminal

1
2
3
4
$ rbenv install 2.0.0-p353 $ rbenv versions system * 2.0.0-p353 (set by /Users/amasok/.rbenv/version)

インストールした2.0.0-p353をglobalに設定

terminal

1
2
3
$ rbenv global 2.0.0-p353 $ ruby -v ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin12.5.0]

以上です。

もしrubyが意図したバージョンに鳴ってない場合は下記コマンドで反映されるかもしれません。

terminal

1
$ rbenv rehash