Skip to content

Instantly share code, notes, and snippets.

@kachick
Created July 29, 2016 19:14
Show Gist options
  • Save kachick/b7437f3ef1446a8b3ed1a4026e640338 to your computer and use it in GitHub Desktop.
Save kachick/b7437f3ef1446a8b3ed1a4026e640338 to your computer and use it in GitHub Desktop.
rubyのtrunkをさっくりbuildしてchrubyから使えるようにする時の僕のやり方

推奨できる物かは知らないけど個人的に楽

Mac OS X + zsh + chruby

ruby_version=$(grep '#define RUBY_VERSION' version.h | grep -o -E '[0-9.]+')
ruby_bin=ruby-${ruby_version}dev.$(git rev-parse --short trunk)
./configure --prefix="$HOME/.rubies/$ruby_bin" --disable-install-doc
make install
source /usr/local/share/chruby/chruby.sh
chruby "$ruby_bin"
@kachick
Copy link
Author

kachick commented Dec 28, 2016

ruby-2.5.0 の trunk を build してみようとしたら、Mac OS X というか brew 使ってて Failed to configure openssl. It will not be installed. と怒られた。なんで前は大丈夫だったんかな。取り敢えずこれで

ruby_version=$(grep '#define RUBY_VERSION' version.h | grep -o -E '[0-9.]+')
ruby_bin=ruby-${ruby_version}dev.$(git rev-parse --short HEAD)
./configure --prefix="$HOME/.rubies/$ruby_bin" --disable-install-doc --with-openssl-dir="$(brew --prefix openssl)"
make install
source /usr/local/share/chruby/chruby.sh
chruby "$ruby_bin"

ref: http://stackoverflow.com/questions/36915504/compiling-ruby-error-failed-to-configure-openssl-it-will-not-be-installed

@kachick
Copy link
Author

kachick commented Dec 28, 2016

@kachick
Copy link
Author

kachick commented Apr 19, 2018

ちょいupdate & rbenv だとこうかな

autoconf
ruby_version=$(grep '#define RUBY_VERSION' version.h | grep -o -E '[0-9.]+')
ruby_bin=${ruby_version}.trunk.$(git rev-parse --short HEAD)
./configure --prefix="$HOME/.rbenv/versions/$ruby_bin" --disable-install-doc --with-openssl-dir="$(brew --prefix openssl)"
make
make install

と思ったらコケた。

@kachick
Copy link
Author

kachick commented Apr 21, 2018

全然 openssl と関係ない死に方しているようなときでも https://qiita.com/KitaitiMakoto/items/677868276a8f7d5a5ce8 で通った。 --with-openssl-dir= だけじゃダメ

@kachick
Copy link
Author

kachick commented May 24, 2019

Update. chruby

autoconf
ruby_revision=$(ruby -e 'puts File.read(ARGV[0]).slice /#define RUBY_REVISION \"(.+)\"/, 1' revision.h)
ruby_bin=trunk.${ruby_revision}.$(git rev-parse --short HEAD)
./configure --prefix="$HOME/.rubies/$ruby_bin" --disable-install-doc --with-openssl-dir="$(brew --prefix openssl)"
make
make install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment