warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777

Ruby on-RailsMacosPermissionsRubygemsWarnings

Ruby on-Rails Problem Overview


Every time I run this command rails server:

> warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777

I searched for a solution here and they said to type: chmod go-w /usr/local/bin

But I get this error:

> chmod: Unable to change file mode on /usr/local/bin: Operation not permitted

I am using OS X by the way.

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

You will need to have root access to do this. If you aren't already the administrative user, login as the administrator. Then use 'sudo' to change the permissions:

sudo chmod go-w /usr/local/bin

Obviously, that will mean you can no longer install material in /usr/local/bin except via 'sudo', but you probably shouldn't be doing that anyway.

Solution 2 - Ruby on-Rails

I had the same error here MacOSX 10.6.8 - it seems ruby checks to see if any directory (including the parents) in the path are world writable. In my case there wasn't a /usr/local/bin present as nothing had created it.

so I had to do

sudo chmod 775 /usr/local

to get rid of the warning.

A question here is does any non root:wheel process in MacOS need to create anything in /usr/local ?

Solution 3 - Ruby on-Rails

Try: sudo chmod go-w /usr/local/bin

The /usr/local/bin directory is owned by the root (i.e. administrator) account, so even if you can write to it, you can't change the permissions on it. The sudo command means "run the following command as root", and works a lot like clicking that lock icon in the System Preferences dialogs.

Solution 4 - Ruby on-Rails

I have had the same issue in OSX. It can be fixed by running Disk Utilities to Repair Permissions. I agree with Peter Nixey: in my case it is caused when my 3G dongle installs or reinstalls its driver. Repairing Permissions afterward fixes the issue.

Solution 5 - Ruby on-Rails

Am using Mountain Lion. What I did was Look for /usr/local and Get Info. On it there is Sharing and Permissions. Make sure that its only the user and Admin are the only ones who have read and write permissions. Anyone else should have read access only. That sorted my problem.

Its normally helpful is your Run disk utilities and repair permissions too.

Solution 6 - Ruby on-Rails

Same here, apparently my /usr/local folder was world writable so I made it 755

# chmod 755 /usr/local

It also appeared that a Hauwei mobile dongle I had used had installed world writeable directories in /usr/local as well

Solution 7 - Ruby on-Rails

If you're running OSX and getting this often, another good thing to consider is to use a built-in OSX permissions fixing tool. If you didn't change the mode of your directories, something else did and there's a chance that other directories have overgenerous permissions as well - this tool will reset them back all to factory defaults, which is a good security idea. There's a great guide on the Apple stackextange about this very process.

Solution 8 - Ruby on-Rails

You need to run

sudo chmod o-w -R /usr/local 

Solution 9 - Ruby on-Rails

Even I came across similar problem. I use KDE on ubuntu 12 and while playing around in my home folder I had accidently changed permissions for Group and Others as "can view and modify content" by right clicking in my home folder and then properties and forgot all about it.

My warning was:

warning: Insecure world writable dir /home/my_home_folder in PATH, mode 040777

So in my case it was the home folder. I did undid the modifications of permissions and I stopped getting those warnings when running the rails server or rake tasks to run my tests.

Solution 10 - Ruby on-Rails

I'm also having the exact same problem with both /usr/local/bin and /etc/sudoers on OSX Snow lepard.Even when i logged in as admin and tried to change the permissions via the terminal, it still says "Operation not permitted". And i did the following to get the permission of these folders.

From the terminal, I accessed /etc/sudoers file and using pico editor i added the following code: username ALL=(ALL) ALL Replace "username" with your MAC OS account name

Solution 11 - Ruby on-Rails

This should resolve your problem: chmod go-w {/path/of/user}

Solution 12 - Ruby on-Rails

I had the same error here MacOSX 10.11 - it seems ruby checks to see if any directory (including the parents) in the path are world writable. In my case there wasn't a /usr/local/bin present as nothing had created it.

Run this command in your terminal.Try this sudo chmod 775 /usr/local After this if you have any password on your mac , then you have to enter the password . Now this issue will be fix.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionXandmanView Question on Stackoverflow
Solution 1 - Ruby on-RailsJonathan LefflerView Answer on Stackoverflow
Solution 2 - Ruby on-RailspeterkView Answer on Stackoverflow
Solution 3 - Ruby on-RailsJanderView Answer on Stackoverflow
Solution 4 - Ruby on-RailsLarry HynesView Answer on Stackoverflow
Solution 5 - Ruby on-RailsMuendoView Answer on Stackoverflow
Solution 6 - Ruby on-RailsMister PView Answer on Stackoverflow
Solution 7 - Ruby on-RailsKyle HotchkissView Answer on Stackoverflow
Solution 8 - Ruby on-RailsJai Kumar RajputView Answer on Stackoverflow
Solution 9 - Ruby on-RailsarkiverView Answer on Stackoverflow
Solution 10 - Ruby on-RailsSayaneeView Answer on Stackoverflow
Solution 11 - Ruby on-RailsaphexlogView Answer on Stackoverflow
Solution 12 - Ruby on-RailsMandeep SinghView Answer on Stackoverflow