title: Avoiding "Another active Homebrew update process is already in progress"
body: <p>I have a script I use for maintaining by Homebrew installation containing the line</p>
  
  <pre><code>brew --config &amp;&amp; echo;  brew update &amp;&amp; echo; brew upgrade &amp;&amp; brew list &amp;&amp; echo; brew leaves &amp;&amp; echo; brew cask list &amp;&amp; echo; 
  </code></pre>
  
  <p>and running (typically) in <code>~</code>. Occasionally when I run this script I get output that includes</p>
  
  <pre><code>Auto packing the repository in background for optimum performance.
  See "git help gc" for manual housekeeping.
  </code></pre>
  
  <p>followed by</p>
  
  <pre><code>Error: Another active Homebrew update process is already in progress.
  Please wait for it to finish or terminate it to continue.
  </code></pre>
  
  <p>How do I prevent this from happening? </p>
  
  <p>From reading the suggested help, I expect that running something like <code>git gc --auto --aggressive &amp;&amp;</code> explicitly first would work, but it's unclear to me how to aim it at the right repo. Or is the cause something else entirely?</p>