I just installed OSX El Capitan and started having trouble with Homebrew. First I followed these instructions: https://ohthehugemanatee.org/blog/2015/10/01/how-i-got-el-capitain-working-with-my-developer-tools/
It didn't help. Then I tried things like changing permissions, doing a hard reset and pulling origin again, uninstalling Homebrew and installing it again, and so on. The error remains. I can run brew doctor and so on, but I can't run brew update (the whole problem started because I ran brew doctor and it recommended that I run brew update). Anyway here's what shows up when I run brew update:
mv: rename /usr/local/Library/Taps/homebrew-versions, to /usr/local/Library/Taps/homebrew/homebrew-versions/homebrew-versions,: No such file or directory /usr/local/Library/Homebrew/cmd/update.sh: line 58: ${#${tap_dir_basename//[^-]}}: bad substitution
And here's the content of line 58 and the following ones, in update.sh:
if [[ ${#${tap_dir_basename//[^\-]}} -gt 1 ]]
then
echo "Homebrew changed the structure of Taps like <someuser>/<sometap>." >&2
echo "So you may need to rename $HOMEBREW_LIBRARY/Taps/$user/homebrew-$repo manually." >&2
fi
else
echo "Homebrew changed the structure of Taps like <someuser>/<sometap>. " >&2
echo "$tap_dir is an incorrect Tap path." >&2
echo "So you may need to rename it to $HOMEBREW_LIBRARY/Taps/<someuser>/homebrew-<sometap> manually." >&2
fi
I'm out of ideas. Googling it, I found other problems in the same area, but never this exact problem. The others were solved by the actions I already tried. Has anyone seen this before?
EDIT: The issue has been solved. Here's the fix:
cd /usr/local
git checkout master
git fetch origin
git reset --hard origin/master
brew update
Posting the above mentioned answer here to mark as answered:
cd /usr/local
git checkout master
git fetch origin
git reset --hard origin/master
brew update