Error while installing Homebrew on Mac OS X (10.10.3): Unable to change file mode on /usr/local/ When I run the command on the home brew website,

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


I get:

==&gt; This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
==&gt; The following directories will be made group writable:
/usr/local/.
==&gt; The following directories will have their owner set to 17oei:
/usr/local/.
==&gt; The following directories will have their group set to admin:
/usr/local/.

Press RETURN to continue or any other key to abort
==&gt; /usr/bin/sudo /bin/chmod g+rwx /usr/local/.
chmod: Unable to change file mode on /usr/local/.: Operation not permitted
Failed during: /usr/bin/sudo /bin/chmod g+rwx /usr/local/.


However, I see no reason for this, as I am an admin on my computer.
From your ls output:

drwxr-xr-x     5 root  wheel  uchg   170 Aug 20  2015 local

That uchg flag means the file or directory cannot be changed. You can remove it with this command: sudo chflags -R nouchg /usr/local

For more information about file flags, see the man page for chflags: http://ss64.com/osx/chflags.html