rbenvã§Rubyã®ãã¼ã¸ã§ã³ã管çãã
rbenvãå©ç¨ãã¦ãRubyã®ãã¼ã¸ã§ã³ãåãæ¿ããæ¹æ³ã®ã¡ã¢ã
å½æ¹ã®ç°å¢
- OS X 10.10.5
Homebrewã§rbenvãã¤ã³ã¹ãã¼ã«
$ ruby -v ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14] # ããªã»ããã®rubyãã¼ã¸ã§ã³ # Homebrewã®æ´æ° $ brew update Updated Homebrew from 9185c50 to dde20cd. ==> Migrating Homebrew to v0.9.9 remote: Counting objects: 271, done. remote: Compressing objects: 100% (219/219), done. remote: Total 271 (delta 142), reused 124 (delta 38), pack-reused 0 Receiving objects: 100% (271/271), 445.51 KiB | 413.00 KiB/s, done. Resolving deltas: 100% (142/142), completed with 140 local objects. From https://github.com/Homebrew/brew + dde20cd...2ca6dbb master -> origin/master (forced update) HEAD is now at 2ca6dbb brew.rb: Donât ask `xcrun` for output if no CLT is installed (#334) ==> Homebrew has enabled anonymous aggregate user behaviour analytics Read the analytics documentation (and how to opt-out) here: https://git.io/brew-analytics ==> Tapping homebrew/core Cloning into '/usr/local/Library/Taps/homebrew/homebrew-core'... remote: Counting objects: 3710, done. remote: Compressing objects: 100% (3593/3593), done. remote: Total 3710 (delta 13), reused 2375 (delta 8), pack-reused 0 Receiving objects: 100% (3710/3710), 2.88 MiB | 224.00 KiB/s, done. Resolving deltas: 100% (13/13), done. Checking connectivity... done. Tapped 3588 formulae (3,736 files, 9.0M) ==> Cleaning up /Library/Caches/Homebrew... Removing: /Library/Caches/Homebrew/binutils-2.25.1.yosemite.bottle.tar.gz... (44.2M) Removing: /Library/Caches/Homebrew/coreutils-8.24.yosemite.bottle.1.tar.gz... (3.3M) Removing: /Library/Caches/Homebrew/nmap-7.00.yosemite.bottle.tar.gz... (6M) Removing: /Library/Caches/Homebrew/openssl-1.0.2d_1.yosemite.bottle.tar.gz... (3.6M) ==> Migrating /Library/Caches/Homebrew to /Users/makoto/Library/Caches/Homebrew. ==> Deleting /Library/Caches/Homebrew... Already up-to-date. # rbenvã®ã¤ã³ã¹ãã¼ã« $ brew install rbenv ==> Installing dependencies for rbenv: autoconf, pkg-config, openssl, rub ==> Installing rbenv dependency: autoconf ==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.yosemite.bott ######################################################################## 100.0% ==> Pouring autoconf-2.69.yosemite.bottle.4.tar.gz ==> Caveats Emacs Lisp files have been installed to: /usr/local/share/emacs/site-lisp/autoconf ==> Summary ðº /usr/local/Cellar/autoconf/2.69: 70 files, 3.0M ==> Installing rbenv dependency: pkg-config ==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.29.1.yosemite. ######################################################################## 100.0% ==> Pouring pkg-config-0.29.1.yosemite.bottle.tar.gz ðº /usr/local/Cellar/pkg-config/0.29.1: 10 files, 627.2K ==> Installing rbenv dependency: openssl ==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2h_1.yosemite.b ######################################################################## 100.0% ==> Pouring openssl-1.0.2h_1.yosemite.bottle.tar.gz ==> Caveats A CA file has been bootstrapped using certificates from the system keychain. To add additional certificates, place .pem files in /usr/local/etc/openssl/certs and run /usr/local/opt/openssl/bin/c_rehash This formula is keg-only, which means it was not symlinked into /usr/local. Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries Generally there are no consequences of this for you. If you build your own software and it requires this formula, youâll need to add to your build variables: LDFLAGS: -L/usr/local/opt/openssl/lib CPPFLAGS: -I/usr/local/opt/openssl/include ==> Summary ðº /usr/local/Cellar/openssl/1.0.2h_1: 1,691 files, 12.0M ==> Installing rbenv dependency: ruby-build ==> Downloading https://github.com/rbenv/ruby-build/archive/v20160602.tar.gz ==> Downloading from https://codeload.github.com/rbenv/ruby-build/tar.gz/v201606 ######################################################################## 100.0% ==> ./install.sh ðº /usr/local/Cellar/ruby-build/20160602: 282 files, 155.5K, built in 9 seconds ==> Installing rbenv ==> Downloading https://homebrew.bintray.com/bottles/rbenv-1.0.0.yosemite.bottle ######################################################################## 100.0% ==> Pouring rbenv-1.0.0.yosemite.bottle.tar.gz ==> Caveats Rbenv stores data under ~/.rbenv by default. If you absolutely need to store everything under Homebrewâs prefix, include this in your profile: export RBENV_ROOT=/usr/local/var/rbenv To enable shims and autocompletion, run this and follow the instructions: rbenv init ==> Summary ðº /usr/local/Cellar/rbenv/1.0.0: 36 files, 61.9K
rbenvã®ä½¿ãæ¹
# ã¤ã³ã¹ãã¼ã«ã§ãããã¼ã¸ã§ã³ã®ç¢ºèª $ rbenv install -l Available versions: 1.8.5-p113 1.8.5-p114 1.8.5-p115 1.8.5-p231 1.8.5-p52 1.8.6-p110 1.8.6-p111 1.8.6-p114 1.8.6-p230 1.8.6-p286 1.8.6-p287 1.8.6-p36 1.8.6-p368 1.8.6-p369 1.8.6-p383 1.8.6-p388 1.8.6-p398 1.8.6-p399 1.8.6-p420 1.8.6 1.8.7-preview1 1.8.7-preview2 1.8.7-preview3 1.8.7-preview4 1.8.7-p160 1.8.7-p17 1.8.7-p173 1.8.7-p174 1.8.7-p22 1.8.7-p248 1.8.7-p249 1.8.7-p299 1.8.7-p301 1.8.7-p302 1.8.7-p330 1.8.7-p334 1.8.7-p352 1.8.7-p357 1.8.7-p358 1.8.7-p370 1.8.7-p371 1.8.7-p373 1.8.7-p374 1.8.7-p375 1.8.7-p71 1.8.7-p72 1.8.7 1.9.0-0 1.9.0-1 1.9.0-2 1.9.0-3 1.9.0-4 1.9.0-5 1.9.1-preview1 1.9.1-preview2 1.9.1-rc1 1.9.1-rc2 1.9.1-p0 1.9.1-p129 1.9.1-p243 1.9.1-p376 1.9.1-p378 1.9.1-p429 1.9.1-p430 1.9.1-p431 1.9.2-preview1 1.9.2-preview3 1.9.2-rc1 1.9.2-rc2 1.9.2-p0 1.9.2-p136 1.9.2-p180 1.9.2-p290 1.9.2-p318 1.9.2-p320 1.9.2-p326 1.9.2-p330 1.9.3-dev 1.9.3-preview1 1.9.3-rc1 1.9.3-p0 1.9.3-p105 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-p426 1.9.3-p429 1.9.3-p448 1.9.3-p484 1.9.3-p545 1.9.3-p547 1.9.3-p550 1.9.3-p551 2.0.0-dev 2.0.0-preview1 2.0.0-preview2 2.0.0-rc1 2.0.0-rc2 2.0.0-p0 2.0.0-p195 2.0.0-p247 2.0.0-p353 2.0.0-p451 2.0.0-p481 2.0.0-p576 2.0.0-p594 2.0.0-p598 2.0.0-p643 2.0.0-p645 2.0.0-p647 2.0.0-p648 2.1.0-dev 2.1.0-preview1 2.1.0-preview2 2.1.0-rc1 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.1.10 2.2.0-dev 2.2.0-preview1 2.2.0-preview2 2.2.0-rc1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3.0-dev 2.3.0-preview1 2.3.0-preview2 2.3.0 2.3.1 2.4.0-dev jruby-1.5.6 jruby-1.6.3 jruby-1.6.4 jruby-1.6.5 jruby-1.6.5.1 jruby-1.6.6 jruby-1.6.7 jruby-1.6.7.2 jruby-1.6.8 jruby-1.7.0-preview1 jruby-1.7.0-preview2 jruby-1.7.0-rc1 jruby-1.7.0-rc2 jruby-1.7.0 jruby-1.7.1 jruby-1.7.2 jruby-1.7.3 jruby-1.7.4 jruby-1.7.5 jruby-1.7.6 jruby-1.7.7 jruby-1.7.8 jruby-1.7.9 jruby-1.7.10 jruby-1.7.11 jruby-1.7.12 jruby-1.7.13 jruby-1.7.14 jruby-1.7.15 jruby-1.7.16 jruby-1.7.16.1 jruby-1.7.16.2 jruby-1.7.17 jruby-1.7.18 jruby-1.7.19 jruby-1.7.20 jruby-1.7.20.1 jruby-1.7.21 jruby-1.7.22 jruby-1.7.23 jruby-1.7.24 jruby-1.7.25 jruby-9.0.0.0.pre1 jruby-9.0.0.0.pre2 jruby-9.0.0.0.rc1 jruby-9.0.0.0.rc2 jruby-9.0.0.0 jruby-9.0.1.0 jruby-9.0.3.0 jruby-9.0.4.0 jruby-9.0.5.0 jruby-9.1.0.0-dev jruby-9.1.0.0 jruby-9.1.1.0 jruby-9.1.2.0 maglev-1.0.0 maglev-1.1.0-dev maglev-2.0.0-dev mruby-dev mruby-1.0.0 mruby-1.1.0 mruby-1.2.0 rbx-2.2.2 rbx-2.2.3 rbx-2.2.4 rbx-2.2.5 rbx-2.2.6 rbx-2.2.7 rbx-2.2.8 rbx-2.2.9 rbx-2.2.10 rbx-2.3.0 rbx-2.4.0 rbx-2.4.1 rbx-2.5.0 rbx-2.5.1 rbx-2.5.2 rbx-2.5.3 rbx-2.5.4 rbx-2.5.5 rbx-2.5.6 rbx-2.5.7 rbx-2.5.8 rbx-2.6 rbx-2.7 rbx-2.8 rbx-2.9 rbx-2.10 rbx-2.11 rbx-2.71828182 rbx-3.0 rbx-3.1 rbx-3.2 rbx-3.3 rbx-3.4 rbx-3.5 rbx-3.6 rbx-3.7 rbx-3.8 rbx-3.9 rbx-3.10 rbx-3.11 rbx-3.12 rbx-3.13 rbx-3.14 rbx-3.15 rbx-3.16 rbx-3.17 rbx-3.18 rbx-3.19 rbx-3.20 rbx-3.21 rbx-3.22 rbx-3.23 rbx-3.24 rbx-3.25 rbx-3.26 rbx-3.27 rbx-3.28 rbx-3.29 rbx-3.30 rbx-3.31 rbx-3.32 rbx-3.33 ree-1.8.7-2011.03 ree-1.8.7-2011.12 ree-1.8.7-2012.01 ree-1.8.7-2012.02 topaz-dev # ä»»æã®ãã¼ã¸ã§ã³ãã¤ã³ã¹ãã¼ã« $ rbenv install 2.2.5 Downloading ruby-2.2.5.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.5.tar.bz2 Installing ruby-2.2.5... Installed ruby-2.2.5 to /Users/makoto/.rbenv/versions/2.2.5 # å©ç¨ã§ãããã¼ã¸ã§ã³ã®ç¢ºèª $ rbenv versions * system (set by /Users/makoto/.rbenv/version) 2.2.5 # æå¹ã«ãªã£ã¦ãããã¼ã¸ã§ã³ã®ç¢ºèª $ rbenv version system (set by /Users/makoto/.rbenv/version) # ç°å¢å ¨ä½ã®ãã¼ã¸ã§ã³ãå¤æ´ $ rbenv global 2.2.5 # ãã£ã¬ã¯ããªåºæã®ãã¼ã¸ã§ã³å¤æ´ $ rbenv local 2.2.5 # ãã¼ã¸ã§ã³ç¢ºèª $ rbenv version 2.2.5 (set by /Users/makoto/.rbenv/version) # rubyã³ãã³ãã§ããã¼ã¸ã§ã³ç¢ºèª $ ruby -v ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14] # ãããã£!!?
ãã¼ã¸ã§ã³ã®åãæ¿ããä¸æããããªãã£ãåå
~/.bash_profileã«ä»¥ä¸ã追è¨ããå¿ è¦ããã£ãã
eval "$(rbenv init -)"
ãããããªãã¨ãrbenvã§ã¤ã³ã¹ãã¼ã«ããrubyã®PATHãåæ ãããªãã
$ vi ~/.bash_profile # eval "$(rbenv init -)"ãè¿½è¨ $ source ~/.bash_profile # .bash_profileãèªã¿è¾¼ã¿ã追è¨ããè¨å®ãåæ # æ¹ãã¦ãã¼ã¸ã§ã³ãç¢ºèª $ ruby -v ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-darwin14]
åèãµã¤ã
rbenvでRubyのバージョンアップをする(for Mac) - Qiita