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.

michaelsnowden
  • 103
  • 1
  • 5

1 Answers1

4

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.

Chris Olin
  • 593
  • 3
  • 8
  • 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 04 '15 at 02:05
  • Yeah, I was multitasking and didn't proofread before clicking submit. Thanks! – Chris Olin Oct 04 '15 at 03:03