I was trying to update Ruby to 2.1.4 using RVM (Ruby Version Manager). Then I encountered an error:
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0
ERROR: '/bin' is not writable - it is required for Homebrew, try 'brew doctor' to fix it!
Requirements installation failed with status: 1.
Unable to install ruby ruby-2.1.4. Please install it manually to continue.
It was because I updated Mac OS X to Yosemite, which has default Ruby version 2.0 (/System/Library/Frameworks/Ruby.framework/Versions/2.0).
I tried various suggested solutions. But they didn't work.
In the end, I created a symbolic link /System/Library/Frameworks/Ruby.framework/Versions/1.8 from /System/Library/Frameworks/Ruby.framework/Versions/Current, which is also a symbolic link from /System/Library/Frameworks/Ruby.framework/Versions/1.8.
Then updating Ruby succeeded.