$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=tomcat.whoami=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 작업이 있을 것입니다.

관련 정보