OS X Yosemite upgrade messed up both brew and nginx on my Mac.
The following are reasonably safer ways to fix both of them.
1. Fix brew
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
2. Fix nginx next
brew install nginx
brew reinstall nginx
/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
$ sudo nginx
nginx: [emerg] mkdir() “/usr/local/var/run/nginx/client_body_temp” failed (2: No such file or directory)