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

34,727

Solution 1

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

Solution 2

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.

Solution 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

...

Solution 4

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.

Solution 5

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.

Share:
34,727

Related videos on Youtube

Trip
Author by

Trip

I program Ruby, C#, iOS, Node, and Augmented Reality for Unity3D. I write PostgreSQL, mySQL, SQLite, and MongoDB. I use Heroku, Amazon, Microsoft Azure. Creator of the Yoga Sutras App, Braidio Mobile, and Braidio. In my spare time, I teach Ashtanga Yoga. elephant trip AT gmail DOT com #happyToHelp

Updated on July 09, 2022

Comments

  • Trip
    Trip almost 2 years

    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.

  • Trip
    Trip about 14 years
    Yes! you are a genius! And that concludes my successful installation of RVM, ruby 1.9, and the 64-bit challenge :D
  • Alex Martelli
    Alex Martelli over 13 years
    @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?!
  • Timulus
    Timulus over 12 years
    Are you saying that this answer is a terrible idea and using it will open up a huge security hole in my system?
  • Kirk Strobeck
    Kirk Strobeck over 11 years
    chmod: /opt/local/bin: No such file or directory
  • Ortwin Gentz
    Ortwin Gentz over 8 years
    This silences all output including output from rake tasks. Not what I want.
  • Davi Lima
    Davi Lima over 8 years
    chmod go-w /usr/local/bin in OSX
  • bradpotts
    bradpotts over 6 years
    thanks, this helped me sort out another problem related to the same issue