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.

Trip
  • 26,756
  • 46
  • 158
  • 277
  • possible duplicate of [ warning Insecure world writable dir](http://stackoverflow.com/questions/3952243/warning-insecure-world-writable-dir) – Kornel Dec 18 '10 at 15:53
  • possible duplicate of [Getting the warning "Insecure world writable dir /home/chance " in PATH, mode 040777 for rails and gem](http://stackoverflow.com/questions/5380671/getting-the-warning-insecure-world-writable-dir-home-chance-in-path-mode-04) – kenorb Sep 20 '14 at 09:43
  • Duplicate of: [warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777](http://stackoverflow.com/questions/3952243/warning-insecure-world-writable-dir-usr-local-bin-in-path-mode-040777) – kenorb Sep 20 '14 at 09:53
  • 1
    @kenorb Eh.. this question was asked first – Trip Sep 21 '14 at 12:26

5 Answers5

95

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

Alex Martelli
  • 854,459
  • 170
  • 1,222
  • 1,395
  • Yes! you are a genius! And that concludes my successful installation of RVM, ruby 1.9, and the 64-bit challenge :D – Trip May 09 '10 at 13:20
  • 2
    @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?! – Alex Martelli Aug 18 '10 at 19:48
  • 1
    Are you saying that this answer is a terrible idea and using it will open up a huge security hole in my system? – Timulus Sep 22 '11 at 18:57
  • 6
    `chmod: /opt/local/bin: No such file or directory` – Kirk Strobeck Dec 22 '12 at 01:28
  • 1
    `chmod go-w /usr/local/bin` in OSX – Davi Lima Jan 20 '16 at 17:43
  • thanks, this helped me sort out another problem related to the same issue – bradpotts Sep 30 '17 at 23:48
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.

jstreebin
  • 441
  • 5
  • 6
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

...

Siddhartha Mukherjee
  • 6,138
  • 3
  • 23
  • 11
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.

Community
  • 1
  • 1
Connor McKay
  • 580
  • 7
  • 13
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.

Igbanam
  • 5,904
  • 5
  • 44
  • 68