Help us understand the problem. What is going on with this article?

Mac で rbenv を使って Ruby をインストールするときに使うスクリプト

More than 5 years have passed since last update.

僕が考えた最強の Ruby インストールスクリプトがこちらになります。

ruby-build が RUBY_CONFIGURE_OPTS_ARRAY をきちんと処理してくれない・・・

#! /bin/bash

PATH=~/.rbenv/bin:~/.rbenv/plugins/ruby-build/bin:$PATH

version=${1:-2.1.0-dev}

trap 'exit 1' 2

eval "$(rbenv init -)"

export RUBY_CONFIGURE_OPTS_ARRAY=( \
  CC=clang CXX=clang++ \
  optflags="-O2 -march=corei7-avx -mtune=corei7-avx" \
  debugflags="-ggdb3" \
)

export RUBY_CONFIGURE_OPTS=" \
  --with-arch=x86_64 \
  --with-valgrind \
  --with-out-ext=tk,tk/* \
  --enable-shared \
  --enable-pthread \
  --disable-install-doc \
  --disable-libedit \
  --with-gdbm-dir=$(brew --prefix gdbm) \
  --with-dbm-dir=$(brew --prefix gdbm) \
  --with-dbm-type=gdbm_compat \
  --with-libyaml-dir=$(brew --prefix libyaml) \
  --with-libffi-dir=$(brew --prefix libffi) \
  --with-openssl-dir=$(brew --prefix openssl) \
  --with-readline-dir=$(brew --prefix readline) \
  --with-opt-dir=$(brew --prefix) \
"

export MAKE_OPTS="-j 2"

[ -d ~/.rbenv/sources/$version ] && rm -rf ~/.rbenv/sources/$version

rbenv install -k -f $version

export RBENV_VERSION=$version
rbenv exec gem update --system 2.1.4
rbenv exec gem install bundler --pre --no-ri --no-rdoc
rbenv rehash

最新版は Gist にあるよ。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away