Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 907567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:34:31+00:00 2026-05-15T16:34:31+00:00

I am trying to run a ruby script as root. When I try to

  • 0

I am trying to run a ruby script as root. When I try to require a gem, ruby says it can’t be found. This is because of $:

$ ruby -e "puts $:"
/opt/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0.beta4/lib
/opt/local/lib/ruby/gems/1.9.1/gems/cgi_multipart_eof_fix-2.5.0/lib
/opt/local/lib/ruby/gems/1.9.1/gems/daemons-1.1.0/lib
/opt/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib
/opt/local/lib/ruby/gems/1.9.1/gems/fastthread-1.0.7/lib
/opt/local/lib/ruby/gems/1.9.1/gems/fastthread-1.0.7/ext
/opt/local/lib/ruby/gems/1.9.1/gems/fastthread-1.0.7/bin
/opt/local/lib/ruby/gems/1.9.1/gems/gem_plugin-0.2.3/bin
/opt/local/lib/ruby/gems/1.9.1/gems/gem_plugin-0.2.3/lib
/opt/local/lib/ruby/gems/1.9.1/gems/json_pure-1.4.3/bin
/opt/local/lib/ruby/gems/1.9.1/gems/json_pure-1.4.3/lib
/opt/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/bin
/opt/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/lib
/opt/local/lib/ruby/gems/1.9.1/gems/msgpack-0.4.3/lib
/opt/local/lib/ruby/gems/1.9.1/gems/nestful-0.0.2/lib
/opt/local/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2/bin
/opt/local/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.2/lib
/opt/local/lib/ruby/gems/1.9.1/gems/num_to_bytes-1.4.1/ext
/opt/local/lib/ruby/gems/1.9.1/gems/num_to_bytes-1.4.1/bin
/opt/local/lib/ruby/gems/1.9.1/gems/open4-1.0.1/lib
/opt/local/lib/ruby/gems/1.9.1/gems/rack-1.2.1/bin
/opt/local/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib
/opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin
/opt/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib
/opt/local/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.9/bin
/opt/local/lib/ruby/gems/1.9.1/gems/ruby-processing-1.0.9/lib
/opt/local/lib/ruby/gems/1.9.1/gems/ruby_parser-2.0.4/bin
/opt/local/lib/ruby/gems/1.9.1/gems/ruby_parser-2.0.4/lib
/opt/local/lib/ruby/gems/1.9.1/gems/rubyforge-2.0.4/bin
/opt/local/lib/ruby/gems/1.9.1/gems/rubyforge-2.0.4/lib
/opt/local/lib/ruby/gems/1.9.1/gems/sexp_processor-3.0.4/lib
/opt/local/lib/ruby/gems/1.9.1/gems/sinatra-1.0/lib
/opt/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/bin
/opt/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib
/opt/local/lib/ruby1.9/site_ruby/1.9.1
/opt/local/lib/ruby1.9/site_ruby/1.9.1/i386-darwin10
/opt/local/lib/ruby1.9/site_ruby
/opt/local/lib/ruby1.9/vendor_ruby/1.9.1
/opt/local/lib/ruby1.9/vendor_ruby/1.9.1/i386-darwin10
/opt/local/lib/ruby1.9/vendor_ruby
/opt/local/lib/ruby1.9/1.9.1
/opt/local/lib/ruby1.9/1.9.1/i386-darwin10
.
$ sudo ruby -e "puts $:"
/opt/local/lib/ruby1.9/site_ruby/1.9.1
/opt/local/lib/ruby1.9/site_ruby/1.9.1/i386-darwin10
/opt/local/lib/ruby1.9/site_ruby
/opt/local/lib/ruby1.9/vendor_ruby/1.9.1
/opt/local/lib/ruby1.9/vendor_ruby/1.9.1/i386-darwin10
/opt/local/lib/ruby1.9/vendor_ruby
/opt/local/lib/ruby1.9/1.9.1
/opt/local/lib/ruby1.9/1.9.1/i386-darwin10
.

Why is this happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T16:34:32+00:00Added an answer on May 15, 2026 at 4:34 pm

    Try sudo -E ruby -e "puts $:".

    From the sudo man page:

       -E          The -E (preserve environment) option will override the env_reset option in sudoers(5)).
                   It is only available when either the matching command has the SETENV tag or the setenv
                   option is set in sudoers(5).
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 499k
  • Answers 499k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer At a guess, the problem lies in this line: Image… May 16, 2026 at 12:39 pm
  • Editorial Team
    Editorial Team added an answer Versions of IE before IE9 don't have an .indexOf() function… May 16, 2026 at 12:39 pm
  • Editorial Team
    Editorial Team added an answer Unless you've defined the makeThumbnail() function take parameters passed by… May 16, 2026 at 12:39 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I tried to run ruby script/server RAILS_ENV=production but somehow it always try to read
I am trying to run growlnotify from inside a ruby script. The command I
I'm trying to run RoR server under ubuntu 9.10: > ruby script/server > =>
I'm trying to load up rails in the test environment using a ruby script.
I'm trying to run some third party bash scripts from within my ruby program.
I am trying to get Hudson to run my ruby based selenium tests. I
So I'm trying to get thin to run as a service with RVM. After
I am trying to test to see if a simple run of a rail
I am trying to use NSTask on to run an ASR Multicast Stream, a
I am trying to install the Facebooker plugin on Rails 3 RC with Ruby

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.