Active Directoryいれたらsudo権限が変更されてbrewコマンドが使えない問題の解決


経緯

会社PCでActive Directoryを入れられた影響でsudo権限がおかしなことになり。もろもろ影響が出ている。
特にHomebrewでbrew installとかbrew upateができない。

あれ、ちょっと前まで使えた気がしたが... :p

hubコマンド使いたくて $ brew install hubしたらerrorがでて萎えた。
sudoたたくとでる↓

error文

$ sudo brew install

You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

対処

1. スーパユーザーにパスワードを指定

そういえばスーパユーザーのパスを設定していなかった。

$ sudo passwd root
Password:
Changing password for root.
New password:
Retype new password:

2. 自分に権限の指定

/usr/local の権限がrootに変わっていたっぽいので、
homebrewを一般ユーザで実行できなくなっていた…


$ ls -la /usr/local/bin/brew

$ sudo chown root /usr/local/bin/brew

通ったっぽい。

3. 満を持してぶりゅー

$ sudo brew install hub

==> Downloading https://homebrew.bintray.com/bottles/hub-2.2.1.mavericks.bottle.
######################################################################## 100.0%
==> Pouring hub-2.2.1.mavericks.bottle.tar.gz
==> Caveats

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completion has been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/hub/2.2.1: 9 files, 9.6M

めでたしめでたし。🍺 見るとテンション上がる。

まとめ

Active Directoryのクソ野郎。