Homebrew doesn't install new apps in El Capitan

just upgraded to beta El Capitan for developers.

Deniss-MBP:src me$ brew install hg
Warning: You are using OS X 10.11.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.
==> Downloading https://mercurial.selenic.com/release/mercurial-3.4.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/mercurial-3.4.2.tar.gz
==> make PREFIX=/usr/local/Cellar/mercurial/3.4.2 install-bin
#include <stdio.h>
         ^
1 error generated.
error: command 'clang' failed with exit status 1
make: *** [build] Error 1

READ THIS: https://git.io/brew-troubleshooting

Warning: You are using OS X 10.11.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.

Any ideas how to make it work?

Note: When I do brew doctor it says

Warning: Your Xcode (6.3.2) is outdated
Please update to Xcode 7.0.
Xcode can be updated from
  https://developer.apple.com/downloads

But I do have xcode-beta 7 installed on my computer. Not sure this is linked. Just in case


Solution 1:

First I recommend you go over this: https://www.reddit.com/r/apple/comments/3994os/rootless_feature_is_in_os_x_1011_and_it_disallows/

The rootless security changed a lot of things in El Capitan, other than that where does your xcode-select point to? You can use xcode-select -h to see the usage, it's very simple.

Solution 2:

Check out El Capitan & Homebrew:

If /usr/local exists already:

sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local

If /usr/local does not exist:

  • Reboot into Recovery mode (Hold Cmd+R on boot) & access the Terminal.
  • In that terminal run: csrutil disable
  • Reboot back into OS X
  • Open your Terminal application and execute:

    sudo mkdir /usr/local && sudo chflags norestricted /usr/local && sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local
    
  • Reboot back into Recovery Mode & access the Terminal again.

  • In that terminal execute: csrutil enable
  • Reboot back into OS X & you'll be able to write to /usr/local & install Homebrew.

Solution 3:

Making a sudo chown -R $(whoami):admin /usr/local will break any agents that may be stored under /usr/local subfolders, that must be owned by root:wheel.

Note: in El Capitan, root:wheel is the default user:group that is set for /usr/local and its subfolders.

In addition, people might have 3rd party kernel extensions that must be also have root:wheel permissions (e.g. antivirus software), otherwise OS X will prevent them to be loaded.

So setting /usr/local to $(whoami) is definitely the worst idea to do.