warning: Insecure world writable dir when I run a ruby or gem command
Asked Answered
A

5

48

Not sure why I'm getting this, but I just installed RVM, the new Ruby 1.9, and reinstalled a bunch of gems, and I get this

/Users/johnsmith/.rvm/rubies/ruby-1.9.1-p378/bin/gem:4: warning: Insecure world writable dir /opt/local/bin in PATH, mode 040777

Everything still runs otherwise, but I was wondering if there was a way I could get rid of it.

Abuzz answered 9/5, 2010 at 2:37 Comment(4)
possible duplicate of [ warning Insecure world writable dir](#3952743)Emulation
possible duplicate of Getting the warning "Insecure world writable dir /home/chance " in PATH, mode 040777 for rails and gemDiploma
Duplicate of: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777Diploma
@Diploma Eh.. this question was asked firstAbuzz
P
95

Just chmod go-w /opt/local/bin at a shell prompt (depending on permissions you may need to sudo to do that).

Playback answered 9/5, 2010 at 3:21 Comment(6)
Yes! you are a genius! And that concludes my successful installation of RVM, ruby 1.9, and the 64-bit challenge :DAbuzz
@ming, any program running on your machine can put anything it wants in /opt/local/bin (so in particular any executable "shadowing" any system one and other such trojans) without so much as a by-your-leave: how is that not insecure?!Playback
Are you saying that this answer is a terrible idea and using it will open up a huge security hole in my system?Changeless
chmod: /opt/local/bin: No such file or directoryVirginity
chmod go-w /usr/local/bin in OSXBabita
thanks, this helped me sort out another problem related to the same issueLair
D
11

To clarify, whatever path returns after it says insecure world writeable, is what you use.

So instead of: chmod go-w /opt/local/bin you would replace /opt/local/bin with whatever your path is.

Dottiedottle answered 25/2, 2013 at 23:16 Comment(0)
A
3

Find your gem path so we can edit the bundler gem. Execute the following in your shell:

$ ruby -r rubygems -e "p Gem.path"

Navigate to your gem path and cd into the version of bundler currently being used. Now navigate to lib -> bundler and open runtime.rb in your favorite text editor. Add “$VERBOSE = nil” to line 2.

require "digest/sha1" 
$VERBOSE = nil 
module Bundler   
class Runtime < Environment
    include SharedHelpers

    def setup(*groups)
      # Has to happen first
      clean_load_path

...

Anastice answered 15/10, 2011 at 10:16 Comment(1)
This silences all output including output from rake tasks. Not what I want.Message
T
1

In some cases (like mine), the stack goes deeper than opt/local/bin. In that case, use

sudo chmod go-w opt/local/*/bin usr/local/*/bin opt/local/bin usr/local/bin

In any case, the error prompts where the insecure world is.

Telepathist answered 14/10, 2011 at 15:43 Comment(0)
S
1

If your environment does not allow you to fix this error properly (i.e. ruby lives on a network share or some such), see this answer for a way to suppress the error.

Scarborough answered 19/2, 2014 at 0:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.