rbenv, ruby-buildを更新 $ cd ~/.rbenv $ git pull origin master $ cd ~/.rbenv/plugins/ruby-build $ git pull origin master
rbenvとruby-buildでRuby環境を最新に保つ
seen from United States
seen from China
seen from United States

seen from United Kingdom
seen from China
seen from United States
seen from United States
seen from Germany

seen from United States
seen from Malaysia
seen from China

seen from Malaysia
seen from Türkiye
seen from Germany
seen from Malaysia

seen from Malaysia
seen from Germany

seen from Sweden
seen from United Kingdom
seen from United States
rbenv, ruby-buildを更新 $ cd ~/.rbenv $ git pull origin master $ cd ~/.rbenv/plugins/ruby-build $ git pull origin master
rbenvとruby-buildでRuby環境を最新に保つ

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
chruby homebrew and native extensions fail...
I always try to run the latest version of ruby, via chruby and ruby-build. Recently I ran into a wierd issue, and I'm not really sure how to resolve it, yet, but managed to work around it. When installing gems with native extensions via bundler, ruby seems to not find libraries installed via homebrew, it works fine just running gem install so. Also all extensions installed seem to stop working between ruby 2.1.0 and 2.1.1. Even though I don't know what's going on, the work around seems to be installing all gems which have native extensions via gem install GEM and running bundle install after the fact. Now everything works again...
archlinuxでrbenv経由でインストールすると失敗するのでそれの対処方法
Applying patches to Ruby before compiling Both rbenv install and ruby-build support the --patch (-p) flag that signals that a patch from stdin should be applied to Ruby, JRuby, or Rubinius source code before the ./configure and compilation steps. Example usage: # applying a single patch $ rbenv install --patch 1.9.3-p429 < /path/to/ruby.patch # applying a patch from HTTP $ rbenv install --patch 1.9.3-p429 <
sstephenson/ruby-build · GitHub
Building ruby with debug symbols using rbenv on OSX 10.7.5
While working with Sinatra I experienced a problem with the PostgreSQL gem. I tried to build Ruby with debug symbols using rbenv, but it was easier to download the source for Ruby and to configure and compile it that way.
The problem
While working with Sinatra and PostgreSQL on a Macbook Pro running OSX 10.7.5 I kept running into an error that prevented PostgreSQL from working correctly with the web server. Database access worked fine from IRB, but when actually running the web server I got an error that simply said:
Trace/BPT trap: 5
Apparently this is a know error for which there isn't yet a fix:
pg gem Trace/BPT trap: 5 error on MAC OS X lion
Ruby 1.8.7 works. Ruby 1.9.2 produces 'Trace/BPT trap: 5'
Binaries will not run. Exits with "Trace/BPT trap: 5"
OSX + postgres + sinatra + ruby = Trace/BPT trap: 5
Software versions
The links above indicate this may be a problem with Ruby 1.9.2, and either the Ruby pg gem or PostgreSQL on OSX Lion. In any, here are the versions for things that may be involved in this:
OSX 10.7.5
PostgreSQL 9.2.2
rbenv 0.4.0
ruby-build 20130408
Ruby 1.9.3-p392
Ruby gems
data_mapper 1.2.0
dm-postgres-adapter 1.2.0
pg 0.15.1
sinatra 1.4.2
thin 1.5.1
False start
At first I tried to build Ruby by going through rbenv:
$ env RUBY_CFLAGS="-O0 -ggdb" rbenv install 1.9.3-p392
Using RUBY_CFLAGS instead of CFLAGS ensures that you use the flags only for building Ruby not anything else (like gems).
For whichever reason, this didn't work, and gdb could not find the object files for Ruby.
Just do it yourself
In order to debug the error I needed to install Ruby with debug symbols. It was harder than expected to determine how to pass the correct compiler flags through rbenv to build Ruby with debug symbols.
This post on StackOverflow was key to figuring it out.
how to pass compilation flags when compiling ruby with rbenv?
It's easier to download the source for Ruby and to configure and build it without using rbenv. Below is what I did, and any references to rbenv are simply because I was experimenting with trying to build while using rbenv.:
$ curl ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz -o ruby-1.9.3-p392.tar.gz $ tar -zxvf ruby-1.9.3-p392.tar.gz $ mv ruby-1.9.3-p392/* /usr/local/var/rbenv/versions/1.9.3-p392/ $ cd /usr/local/var/rbenv/versions/1.9.3-p392/ $ CFLAGS="-O0 -ggdb" ./configure --prefix=/usr/local/var/rbenv/versions/1.9.3-p392/ $ env RUBY_CFLAGS="-O0 -ggdb" rbenv install 1.9.3-p392
Starting gdb
Base on Thoughtbot's guide
If you're using rbenv, remember to get the path to the actual ruby binary, not the path to shim.
$ rbenv version 1.9.3-p392 (set by /usr/local/var/rbenv/version)
Start your script, get the pid, and attach gdb to it:
$ /usr/local/var/rbenv/versions/1.9.3-p392/bin/ruby example.rb $ ps $ gdb /usr/local/var/rbenv/versions/1.9.3-p392/bin/ruby PID

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Install ruby 2.0.0-p353 with rbenv
I want to use the 2.0.0-p353 ruby with rbenv. But when I list the available versions, it's not listed. It seems I have an outdated version list.
$ rbenv install --list
I'm not getting the p353. In order to get it, I have to upgrade the ruby-build package and not the rbenv. I installed rbenv and ruby-build via Homebrew, so I tried:
$ brew upgrade ruby-build Error: ruby-build-20131008 already installed
Ok let's try it with this:
$ brew install --HEAD ruby-build Error: ruby-build-20131008 already installed To install this version, first `brew unlink ruby-build'
Clear, first I have to unlink it than upgrade it, to the latest (Development release)
$ brew unlink ruby-build Unlinking /usr/local/Cellar/ruby-build/20131008... 4 links removed $ brew install --HEAD ruby-build ==> Cloning https://github.com/sstephenson/ruby-build.git Cloning into '/Library/Caches/Homebrew/ruby-build--git'... remote: Counting objects: 127, done. remote: Compressing objects: 100% (90/90), done. remote: Total 127 (delta 48), reused 101 (delta 33) Receiving objects: 100% (127/127), 38.88 KiB | 0 bytes/s, done. Resolving deltas: 100% (48/48), done. Checking connectivity... done ==> ./install.sh /usr/local/Cellar/ruby-build/HEAD: 97 files, 428K, built in 3 seconds
Nice! Success. So let's try to list it again:
$ rbenv install --list ... 2.0.0-p195 2.0.0-p247 2.0.0-p353 ...
All done, it's there. Only one thing has remained: Install this patch version.
$ rbenv install 2.0.0-p353
Mac で rbenv を使った Ruby 開発環境を整える
最近は Python だけじゃなくて Ruby もやっておかないとなあと思いつつ時間だけが過ぎているので、ひとまず rbenv を使った開発環境だけでも整えてみることにした。 インストールは Homebrew から。
$ brew install rbenv ruby-build rbenv-gemset
どうやら rbenv はプラグインのような形で機能追加ができるようになっているようだ。 ruby-build を使うと複数バージョンの Ruby をビルドできるらしい。Python でいうところの Pythonz か。そして rbenv-gemset を使うとパッケージを入れる場所が複数作れるらしい。Python でいうところの virtualenv か。 次にパスを通す。zsh を使っているときは引数が必要みたい。
$ cat << EOF >> ~/.zshenv if which rbenv > /dev/null; then eval "$(rbenv init - zsh)"; fi EOF
bash のときは無くても良い。
$ cat << EOF >> ~/.bash_profile if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi EOF
rbenv が使えるようになったら、次にインストール可能な Ruby 処理系の一覧を表示する。たくさんある。
$ rbenv install -l
幾つか見繕ってインストールしてみる。 インストールしたら必ず rehash コマンドが必要らしい。
$ rbenv install 2.0.0-p247 $ rbenv install 1.9.3-p448 $ rbenv rehash
インストール済みの Ruby を表示する。 まだ "system" なので rbenv を使ってインストールしたものは使われていない。
$ rbenv versions * system (set by /Users/amedama/.rbenv/version) 1.9.3-p448 2.0.0-p247
システム全体で使う Ruby は global コマンドで切り替えられる。
$ rbenv global 2.0.0-p247 $ rbenv versions system 1.9.3-p448 * 2.0.0-p247 (set by /Users/amedama/.rbenv/version)
特定のディレクトリで使う Ruby は local コマンドで切り替える。
$ mkdir Workplace $ cd Workplace $ rbenv local 1.9.3-p448 $ rbenv versions system * 1.9.3-p448 (set by /Users/amedama/Workplace/.ruby-version) 2.0.0-p247 $ ruby --version ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin13.0.0]
このままだと、まだ Gem の環境がシステムで使われているものと一体になってしまっているので gemset を新たに作る。
$ rbenv gemset create 1.9.3-p448 sandbox created sandbox for 1.9.3-p448
このディレクトリで使う gemset を .rbenv-gemsets ファイルで指定する。 何でここだけコマンド化されていないんだろう?不思議だ。
$ echo sandbox > .rbenv-gemsets $ rbenv gemset list 1.9.3-p448: sandbox
これでまっさらな環境ができた。
$ gem list *** LOCAL GEMS ***
当然ディレクトリを移動するとシステムの Gem が見えるようになる。
$ cd .. $ gem list *** LOCAL GEMS *** bigdecimal (1.2.0) io-console (0.4.2) json (1.7.7) ...(snip)
いいかんじだね!
さくらVPSにruby build, rbenvで環境構築したメモ
新プランに乗り換え忘れていたことに気づきました。すげー凹んでます(出落ち)。
せっかく借りているVPSだから、たまには使おうと思って、rbenv, ruby buildでruby 1.9.3をユーザディレクトリにインストールした手順を忘れないようにメモしておく。ちなみにシェルはzshを使っているので、bashとかの人は.zshrcとかを適宜、.bashrcに置き換えればおk。
0. yum <update|install> git
macだとHomebrewだけど、CentOSのパッケージ管理はyumなので、インストールまたは最新版にアップデートしてあげる。ついでに最近使い始めたtmuxを入れておいた。
sudo yum update git
1. ruby buildのインストール
ruby buildを適当なディレクトリ(僕は~/gitって名前にしてる)にてgit cloneして、シェル叩くだけ。githubに手順が書いてあるので、そのとおりにやるだけ。
cd git git clone git://github.com/sstephenson/ruby-build.git cd ruby-build sudo ./install.sh
これで、ruby buildがインストールされた。
2. rbenvのインストール
rbenvのインストールを行う。githubのrbnevのリポジトリのインストール手順通りに行えば良い。この手順だと.zshrcの最下行に追記されるので、それが嫌な人は、自分で書けばいい。
cd git clone git://github.com/sstephenson/rbenv.git .rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc echo 'eval "$(rbenv init -)"' >> ~/.zshrc source .zshrc rbenv install 1.9.3-p194 rbenv global 1.9.3-p194
ログインし直して、ruby -vしてみる。
ruby -v ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
3. bundlerのインストール
bundlerはインストールしておいた方が何かと便利なので、盲目的に入れておく。
gem install bundler rbenv rehash
4. 次
NginxとRails入れる。