Homebrew install specific version of formula?

后端 未结 27 2487
渐次进展
渐次进展 2020-11-21 11:21

How do I install a specific version of a formula in homebrew? For example, postgresql-8.4.4 instead of the latest 9.0.

27条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-21 12:19

    I just used Homebrew to go back to Maven 2.2.1 since the simple brew install maven installed Maven 3.0.3.

    First you have to leave the maven dir there so

    $ brew unlink maven
    

    Use the brew tap command

    $ brew tap homebrew/versions
    Cloning into '/usr/local/Library/Taps/homebrew-versions'...
    remote: Counting objects: 590, done.
    remote: Compressing objects: 100% (265/265), done.
    remote: Total 590 (delta 362), reused 549 (delta 325)
    Receiving objects: 100% (590/590), 117.49 KiB | 79 KiB/s, done.
    Resolving deltas: 100% (362/362), done.
    Tapped 50 formula
    

    Now you can install the maven2 formula:

    $ brew install maven2
    ==> Downloading http://www.apache.org/dist/maven/maven-2/2.2.1/binaries/apache-maven-2.2.1-bin.tar.gz
    ######################################################################## 100.0%
    /usr/local/Cellar/maven2/2.2.1: 10 files, 3.1M, built in 6 seconds
    
    $ mvn --version
    Apache Maven 2.2.1 (r801777; 2009-08-06 12:16:01-0700)
    Java version: 1.6.0_37
    Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    Default locale: en_US, platform encoding: MacRoman
    OS name: "mac os x" version: "10.7.4" arch: "x86_64" Family: "mac" 
    

    Edit: You can also just brew switch maven 2.2.1 to switch to a different version.

    Edit: The Apache Maven project reorganized their repo. Updated this answer to account for this change.

提交回复
热议问题