Search code examples
rubyphantomjshomebrewsencha-cmdmacos-sierra

Why ruby gem, brew and sencha cmd not working in MacOS Sierra?


I was highly ambitious about MacOS Sierra release version 10.12 but it's verily dishearten me causes of broken development environment. Crashes most of my project those were smoothly developed and deployment on previous version of OS X El Capitan. Ruby gem show following messages:

$ gem -v
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin16/rbconfig.rb:213: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
2.5.0

sencha cmd unable to build project for error from Ruby

[INF] executing compass using system installed ruby runtime
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin16/rbconfig.rb:213: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777

Also build failure for error from phantomjs

[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.ExProcess: phantomjs process exited with code 139
[ERR]   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMetho
[ERR] dAccessorImpl.java:57)

phantomjs failure/crashed in MacOS Sierra, brew not working properly as it's depend on Ruby. Following error occurred with message:

brew update
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin16/rbconfig.rb:213: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Already up-to-date.

In this situation it's a disaster for me. I wanna get relief from this situation. After googling an hours or more found the common opinion from the expertise that it's quite impossible to revert it to OS X El Capitan. But there is an option of install of OS X El Capitan. Do you have any suggestion regarding to issue?


Solution

  • Recent versions of OSX/macOS have implemented a system called System Integrity Protection which restricts user access to writing to certain directories such as /usr, /var, /sys etc. Most of these permissions can be changed fairly simply (/usr/bin is one I've had to change after a few OS upgrades) however the top-level directories I mentioned before are impossible to change permissions for without booting into recovery mode, even with sudo or root.

    From the error messages it appears Ruby is having trouble writing to /usr/local/bin, which is also used by Homebrew to store binaries, and is also encouraged by Apple to be used for storing user-made executables and binaries. To change the permissions for /usr/local/bin and any other directories causing trouble, try executing:

    sudo chown $(whoami) /usr/local/bin

    And then re-running any commands using Ruby that failed. Hope this helps!