Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to not update homebrew automatically when brew install some packages?

I installed python3 with homebrew on my Mac. However, the latest Python3.6 cannot work well with some packages, so I decide to roll back to the 3.5.2.

Since homebrew/versions has been deprecated,I checkout the commit in the directory: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula

git log python3.rb

There

commit ec545d45d4512ace3570782283df4ecda6bb0044
Author: BrewTestBot <[email protected]>
Date:   Tue Oct 11 06:42:06 2016 +0100

      python3: update 3.5.2_3 bottle.

Then

git chekcout ec545 
brew install python3

However, it seems that homebrew update itself automatically I run $brew install [Formula]

➜  Formula git:(ec545d4) brew install python3
    Updating Homebrew...

How to not update homebrew automatically when brew install some packages? Or how to install python 3.5.2 with homebrew?

like image 996
Leon Avatar asked Jan 08 '17 06:01

Leon


1 Answers

Answer for the first question, How to not update homebrew automatically when brew install some packages?

  1. hack code solution:

    vim /usr/local/Homebrew/Library/Homebrew/brew.sh

    Add return after line

    update-preinstall() {

    to:

    update-preinstall() {
    return
    
  2. environment variable solution:

    export HOMEBREW_NO_AUTO_UPDATE=1

    or

    export HOMEBREW_AUTO_UPDATING=0

    or

    export HOMEBREW_UPDATE_PREINSTALL=0

if U will always work, add it to .bash_profile

like image 122
user2495402 Avatar answered Oct 03 '22 17:10

user2495402