1

I installed rvm and Ruby 1.9.3p194 on a Raspberry Pi using Debian Linux. When I installed pry using gem install pry, everything installed perfectly but typing pry in a terminal didn't work:

pi@raspberrypi ~ $ pry
bash: pry: command not found

there's a pry file in ~/.rvm/gems/ruby-1.9.3-p194/bin. I have to call it with ruby_noexec_wrapper in the same directory:

pi@raspberrypi ~ $ .rvm/gems/ruby-1.9.3-p194/bin/pry
/usr/bin/env: ruby_noexec_wrapper: No such file or directory
pi@raspberrypi ~ $ cd .rvm/gems/ruby-1.9.3-p194/bin
pi@raspberrypi ~/.rvm/gems/ruby-1.9.3-p194/bin $ ./ruby_noexec_wrapper pry
[1] pry(main)>

What's the proper way to run pry in this Linux? On Windows and Mac OS X I can simply type pry at any command prompt or terminal.

UPDATE: Here's my rvm info:

pi@raspberrypi ~/.rvm/gems/ruby-1.9.3-p194/bin $ rvm info

ruby-1.9.3-p194:

  system:
    uname:       "Linux raspberrypi 3.1.9+ #168 PREEMPT Sat Jul 14 18:56:31 BST 2012 armv6l GNU/Linux"
    bash:        "/bin/bash => GNU bash, version 4.2.20(1)-release (arm-unknown-linux-gnueabihf)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.14.10 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "1 day 23 hours 36 minutes 30 seconds ago"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.3p194"
    date:         "2012-04-20"
    platform:     "armv6l-linux-eabi"
    patchlevel:   "2012-04-20 revision 35410"
    full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [armv6l-linux-eabi]"

  homes:
    gem:          "/home/pi/.rvm/gems/ruby-1.9.3-p194"
    ruby:         "/home/pi/.rvm/rubies/ruby-1.9.3-p194"

  binaries:
    ruby:         "/home/pi/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
    irb:          "/home/pi/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
    gem:          "/home/pi/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
    rake:         "/home/pi/.rvm/gems/ruby-1.9.3-p194@global/bin/rake"

  environment:
    PATH:         "/home/pi/.rvm/gems/ruby-1.9.3-p194/bin:/home/pi/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/pi/.rvm/rubies/ruby-1.9.3-p194/bin:/home/pi/.rvm/bin:/usr/lib/arm-linux-gnueabihf/libfm:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
    GEM_HOME:     "/home/pi/.rvm/gems/ruby-1.9.3-p194"
    GEM_PATH:     "/home/pi/.rvm/gems/ruby-1.9.3-p194:/home/pi/.rvm/gems/ruby-1.9.3-p194@global"
    MY_RUBY_HOME: "/home/pi/.rvm/rubies/ruby-1.9.3-p194"
    IRBRC:        "/home/pi/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
    RUBYOPT:      ""
    gemset:       ""
3

gem install pry

If you want to include the bin directory used by gem, you will need to add it to your $PATH.

bin directories generally contain executables and if you echo $PATH you'll see a number of them there.

If you had installed pry from the distro package, apt install pry, then likely it would be in a normal system bin. However, the distro version (0.10) is probably older than the one installed by gem, and will not get updated as often (presuming gem, or you, update stuff it installs).

To add to $PATH:

export PATH $HOME/.rvm/gems/ruby-1.9.3-p194/bin:$PATH

This prefixes that directory. It is important not to replace the rest of it, which is why there's :$PATH at the end.

You may prefer to use a symlink:

ln -s ~/.rvm/gems/ruby-1.9.3-p194/bin ~/ruby-bin

And use that (~/ruby-bin) in $PATH for brevity and to blackbox the current version string.

To make it permanent, put that export command in ~/.profile. Note that it applies only to the current shell session, so if you have added it in one GUI terminal it won't magically apply to a concurrent one. Also note that .profile may not be run if you use a GUI login. To check just login again and echo $PATH.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.