0

This is more of an annoyance than something that actually affects my code, but I figured I'd ask about it in case someone else has found a solution.

Every time I start up my terminal, this long list of Homebrew commands populates, and it is just incredibly irritating.

Any advice on how to stop this from populating every time i startup my terminal? I'm on a Mac if that matters.

Any help or insight would be much appreciated. Thanks!

List of Homebrew commands

0

2 Answers 2

2

So I did a bit of digging, and I found that the issue stemmed from my .zprofile file. With the new M1 macs, we are required to add a line of code to a file titled .zprofile when installing Homebrew by running the command below.

echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile

eval $(/opt/homebrew/bin/brew shellenv)

After looking in my .zprofile file, I noticed several lines of the following code: eval "$(/opt/homebrew/bin/brew)", which I believe is an older version that does not work with the new M1 macs. I must have typed that command in several times when it wasn't working because (again, after digging) I learned that the echo command adds a new line to the .zprofile file every time it's run. (Src: comments from https://stackoverflow.com/questions/69422964/brew-command-line-mac-is-not-working-without-following-steps).

To solve the problem, I went into my .zprofile file in TextEdit and removed all of those extra lines of text. Now, when my terminal loads, it is clean!

1

The shell in your case (which you can determine by typing echo $SHELL) has startup files that are the most likely source of this. You may need some help editing that file for syntax errors as well.

Worst case, you can search here for questions relating to dotfiles and your shell if that helps narrow down what this means to you for next steps.

Very rarely, it can be startup commands for the application that you run to get to your shell.

2
  • 1
    I think I figured it out. In my .zprofile file, I had 5 lines of eval "$(/opt/homebrew/bin/brew shellenv)" and 2 lines of eval "$(/opt/homebrew/bin/brew)". I installed homebrew awhile ago, but it must not have worked at first, so I kept entering the same command, not knowing that it was writing to my .zprofile file. A comment in this inquiry helped me narrow it down. stackoverflow.com/questions/69422964/… Commented Sep 27, 2022 at 22:26
  • 1
    Nice. Please post an answer as your process and words will help far more people that have the same question as you. This happens to a ton of people getting started with shell customization - the syntax can be opaque, indeed.
    – bmike
    Commented Sep 27, 2022 at 22:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .