0

I'm trying to re-install homebrew on my mac.

I get this error:

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$ 

It's this line that troubles me:

chown: tomcat: illegal user name

I googled homebrew "the following directories will have their owner set to", and only found one search result, which was the homebrew install script

My username isn't tomcat, as far as I know.

Specifically, this is the line of the script that's giving me trouble:

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

The problem, from what I can gather, is that $USER=tomcat, but whoami=michael.snowden

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

EDIT The only thing i found in my ~/.bash* files referencing "tomcat" was something I did to see if tomcat was a valid user after creating this post.

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

EDIT This got resolved, but the solution was really specific to my computer's setup and took a lot of digging.

  • Is one of your shell init files (~/.bashrc, ~/.bash_profile, ~/.profile) changing it? – jordanm Oct 4 '15 at 0:25
  • @jordanm I'll check – michaelsnowden Oct 4 '15 at 0:27
  • @jordanm See the edit – michaelsnowden Oct 4 '15 at 0:34
  • Uid collision ? – Jeff Schaller Oct 4 '15 at 1:04
  • 1
    Turned out to be an external shell script sourced in the ~/.bashrc and ~/.bash_profile that caused the issue. – vinod Oct 4 '15 at 1:35
2

Obviously, something overwrote the $USER variable. You can either spend hours trying to retrace what could have caused this, or run the following commands in order.

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

If it happens again, the -x flag will show you what commands were run and what they did, including any variables that were initialized or modified. It won't tell you specifically what caused this to happen, but it will help narrow down if it was a file being sourced or some part of the Ruby file being executed that caused this. A little bit of grepping will go along way.

  • Might want to indent that command so the backticks show up. Tried to edit it myself, but the system said it's too small of an edit. (I hate that rule.) – glibdud Oct 4 '15 at 2:05
  • Yeah, I was multitasking and didn't proofread before clicking submit. Thanks! – Chris Olin Oct 4 '15 at 3:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.