MacOS install the old version of the software by homebrew

1. Install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2. If you want to install the latest version of the software, you can directly use the following command to install the gdb as an example:

brew install gdb

3. If you want to install the old version of the software, you can check the software version currently supported in Homebrew website:

https://formulae.brew.sh/formula/

Such as search gdb, the current can be directly downloaded only version 8.3, for example, that I want to download gdb 8.2.1 version, then it can not be directly downloaded with brew install gdb,

In this case, the following methods needs to be used to install:

(1) found by https://formulae.brew.sh/formula/ website gdb, click to go to gdb.rb address on the github: https://github.com/Homebrew/homebrew-core/blob/master/ Formula / gdb.rb  , click history, of good luck, it can link the old version of the file rb, bad luck, will give a command to make ourselves the following query:

 git log master -- Formula/gdb.rb

(2) using whole git clone clone hemebrew-core local

git clone https://github.com/Homebrew/homebrew-core.git

(3) into the homebrew-core directory, execute the above git log master - Formula / gdb.rb order to obtain gdb.rb submission history:

 

Find gdb submitted 8.2.1 version, re-checkout the local to the corresponding version, as I select the last 8.2.1 version of commitid it appears:

git checkout ada036ff43e82206bd4d940fecb3253a0150395a

Then enter the Formula directory, execute the following command to install gdb 8.2.1 version:

brew install gdb.rb

Finally, look at the installed version of gdb:

 

 

 

 

Guess you like

Origin www.cnblogs.com/tsts/p/11183605.html