RVMを公式サイトのやりかたを見ながらインストールしたのですが、
なぜかrubyを動かそうとすると、そんなコマンドは無いと言われました。
今回は、この対応メモです。
223n@ja223n:~$ ruby -v bash: ruby: コマンドが見つかりません
PC: DELL Inspiron 14
OS: Debian 9 (stretch) 64bit
223n@ja223n:~$ rvm install ruby-head Warning, new version of rvm available '1.29.4', you are using older version '1.29.3'. You can disable this warning with: echo rvm_autoupdate_flag=0 >> ~/.rvmrc You can enable auto-update with: echo rvm_autoupdate_flag=2 >> ~/.rvmrc Checking requirements for debian. Requirements installation successful. Installing Ruby from source to: /home/tatami/.rvm/rubies/ruby-head, this may take a while depending on your cpu(s)... Cloning from https://github.com/ruby/ruby.git, this may take a while depending on your connection. HEAD is now at 297ae3437e mjit.c: clean up unit link from iseq From https://github.com/ruby/ruby * branch trunk -> FETCH_HEAD Already up-to-date. git checkout trunk Copying from repo to src path... ruby-head - #autoreconf. ruby-head - #configuring.................................................| ruby-head - #post-configuration.. ruby-head - #compiling...................................................- ruby-head - #installing............... ruby-head - #making binaries executable.. Installed rubygems 3.0.0.beta1 is newer than ignore provided with installed ruby, skipping installation, use --force to force installation. ruby-head - #gemset created /home/tatami/.rvm/gems/ruby-head@global ruby-head - #importing gemset /home/tatami/.rvm/gemsets/global.gems....... ruby-head - #generating global wrappers........ ruby-head - #gemset created /home/tatami/.rvm/gems/ruby-head ruby-head - #importing gemsetfile /home/tatami/.rvm/gemsets/default.gems evaluated to empty gem list ruby-head - #generating default wrappers........ ruby-head - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). Install of ruby-head - #complete Ruby was built without documentation, to build it run: rvm docs generate-ri
さらに、Useコマンドを実行したところ、なにやらおかしなことを言われます。
223n@ja223n:~$ rvm use ruby-head RVM is not a function, selecting rubies with 'rvm use ...' will not work. You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use `/bin/bash --login` as the command. Please visit https://rvm.io/integration/gnome-terminal/ for a example.
確かに、 /bin/bash –login を実行すると、rubyは正しく動くようです。
参照関連が正しく設定されていないと思い調べたところ、こちらの記事を見つけました。
RVM 経由で Ruby を入れるときにハマったこと / tsujimotterのノートブック
記事にもあるとおり、以下のコマンドを実行する必要があったみたいです。
source ~/.rvm/scripts/rvm
今回は、~/.bashrcの最後に上のコマンドを追加して、正常に動くことを確認しました。