homebrew - how to install older versions

后端 未结 3 1629
天命终不由人
天命终不由人 2020-12-22 20:24

I\'m trying to install memcached with older versions (ex: 1.4.5) but I\'m not sure how to do it.

brew install memcached installs the latest.

I

相关标签:
3条回答
  • 2020-12-22 20:41

    Usually, you can check if multiple versions are available and you can specify the version with @. e.g. brew install package@2.8

    $ brew info memcached
    
    memcached: stable 1.4.24
    High performance, distributed memory object caching system
    https://memcached.org/
    Conflicts with:
      mysql-cluster (because both install `bin/memcached`)
    Not installed
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/memcached.rb
    ...
    

    If is not available the version you want you can go to the repo, and check the history

    cd "$(brew --repo homebrew/core)"
    git log master -- Formula/memcached.rb
    

    Then you can find the commit you are looking for

    commit 5ec463decefeaab3d1825b923ad2dbee73ffc6dc
    Author: Adam Vandenberg <flangy@gmail.com>
    Date:   Fri Apr 9 21:19:48 2010 -0700
    
        Update memcached to 1.4.5
    

    Checkout that version and install:

    cd "$(brew --repo homebrew/core)" && git checkout 5ec463decefeaab3d1825b923ad2dbee73ffc6dc
    HOMEBREW_NO_AUTO_UPDATE=1 brew install memcached
    

    Once you get the version installed, you can bring brew to its latest version with:

    git checkout master
    

    and, that's it!

    0 讨论(0)
  • 2020-12-22 20:47

    A more expanded version of the good answer from Adrian is also here on SO.

    https://stackoverflow.com/a/53766019/3794873

    One thing to keep in mind is that if you are installing an older Formula the Homebrew API/methods may have changed since that time so you should brew edit appFormula against the current version and compare to the brew edit app@your.version if you encounter any errors trying to brew install app@your.version after the brew extract command in the answer linked.

    0 讨论(0)
  • 2020-12-22 20:54

    I would do

    brew unlink memecached
    brew install memecached@1.4.5
    brew link memecached@1.4.5 --force
    
    0 讨论(0)
提交回复
热议问题