$USER != フアミ

$USER != フアミ

Macにホームブレンドを再インストールしようとしています。

次のエラーが発生します。

michaels-1856:~ michael.snowden$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
==> The following directories will be made group writable:
/usr/local/bin
/usr/local/share
/usr/local/share/man
/usr/local/share/man/man1
==> The following directories will have their owner set to tomcat:
/usr/local/bin
/usr/local/share
/usr/local/share/man
/usr/local/share/man/man1
==> The following directories will have their group set to admin:
/usr/local/bin
/usr/local/share
/usr/local/share/man
/usr/local/share/man/man1

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/bin /usr/local/share /usr/local/share/man /usr/local/share/man/man1
Password: 
==> /usr/bin/sudo /usr/sbin/chown tomcat /usr/local/bin /usr/local/share /usr/local/share/man /usr/local/share/man/man1
chown: tomcat: illegal user name
Failed during: /usr/bin/sudo /usr/sbin/chown tomcat /usr/local/bin /usr/local/share /usr/local/share/man /usr/local/share/man/man1
michaels-1856:~ michael.snowden$ 

私をいじめるのは次の行です。

chown: tomcat: illegal user name

グーグルをしてみるとhomebrew "the following directories will have their owner set to"検索結果がちょうど一つ出てきましたね。自分で作成したインストールスクリプト

私が知る限り、私のユーザー名はtomcatではありません。

具体的には、以下は私に問題を引き起こすスクリプトを減らします。

"The following directories will have their owner set to #{Tty.underline 39}#{ENV['USER']}#{Tty.reset}:"

私が知っている限り、問題は次のとおりです$USER=tomcatwhoami=michael.snowden

michaels-1856:~ michael.snowden$ whoami
michael.snowden
michaels-1856:~ michael.snowden$ echo $USER
tomcat

編集する 私がファイルで見つけた「tomcat」への唯一の参照は、~/.bash*tomcatが有効なユーザーであることを確認するためにこの記事を書いた後の私の仕事でした。

michaels-1856:~ michael.snowden$ cat ~/.bash* | grep tomcat
chown tomcat test.txt

編集する 問題は解決しましたが、解決策は実際に私のコンピュータ設定に限定されており、多くの調査が必要でした。

ベストアンサー1

明らかに何かが$ USER変数を上書きしました。この問題の原因を追跡するのに数時間を費やすか、次のコマンドを順番に実行できます。

export USER=`whoami`
bash -x -c ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

これが再び発生すると、-xフラグは初期化または変更された変数を含む実行されたコマンドと実行されたアクションを表示します。これは何が起こるのかを具体的に知らせませんが、原因がソースファイルであるか実行中のRubyファイルの一部であるかを判断するのに役立ちます。その過程でいくつかのgrep作業があります。

おすすめ記事