开发者

How to Understand My Ruby Environment in Ubuntu?

开发者 https://www.devze.com 2023-02-28 08:47 出处:网络
I am having some path issues and trying to understand how to read and match the paths.Here is what I am doing:

I am having some path issues and trying to understand how to read and match the paths. Here is what I am doing:

$PATH
bash: /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/bin:/home/agenadinik/.rvm/gems/ruby-1.9.2-p180@global/bin:/home/agenadinik/.rvm/rubies/ruby-1.9.2-p180/bin:/home/agenadinik/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: No such file or directory

And then I am trying to see what is in my ruby environment:

$gem environment
/home/agenadinik/.rvm/rubies/ruby-1.9.2-p180/bin/gem:4: 
RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.2
  - RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [i686-linux]
  - INSTALLATION DIRECTORY: /home/agenadinik/.rvm/gems/ruby-1.9.2-p180
  - RUBY EXECUTABLE: /home/agenadinik/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
  - EXECUTABLE DIRECTORY: /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /home/agenadinik/.rvm/gems/ruby-1.9.2-p180
     - /home/agenadinik/.rvm/gems/ruby-1.9.2-p180@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

What I don't understand is which of my paths need to be matched up in my ruby environment and the $PATH

Also, is my $PATH pretty much what is set in my /home/username/.bashrc file? What is usually the path of the Ruby 开发者_StackOverflowexecutable that I need to point to?

Also, doing which ruby returns this:

$ which ruby
/home/agenadinik/.rvm/rubies/ruby-1.9.2-p180/bin/ruby

Thanks!!


You are using RVM. You have many available Ruby paths. When you source the RVM scripts in your bashrc it will modify your path. Every time you rvm use XXX it will modify your path to reflect the new version of Ruby and update all of the bins to match that version. If you are trying to make a proper shebang for a Ruby script you should use env.

#!/usr/bin/env ruby

This will find the current ruby executable in your path.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号