1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

brew install old version's formula

Last updated at Posted at 2023-01-27

Background

Sometime if we want to install some old version's formula, for example I was hope to install a old version python with brew.
Basically we can install the latest version of 3.7, for now it is 3.7.16, but what if I want to install 3.7.2?

Here introduce a way to do it.

Extract the old version

First extract the specified version to local, it will show the saved path when extract succeed.

brew extract --version=3.7.2 python homebrew/cask

Install the old version of python

Then we can install the specified version directly.

brew install python@3.7.2

Edit formula if necessary

Sometimes, when we install the old version, it often has some issues, we may need do some fix for the formula, we can use this command to do this.

brew edit python@3.7.2

It will open a editor and let you edit the formula.

By setting the environment variable HOMEBREW_EDITOR to choose the editor for editing. Such as if we use vim for editing we can setup a variable in ~/.zshrc or ~/.bashrc.

HOMEBREW_EDITOR=vim

Debug formula installation

Sometimes we need to know what error occurred or why the installation failed. We can add -vd options for investigation when install the formula.

brew install -vd python@3.7.2

If we got a error for the installation, it will stop and show some options for debuging. We can choose 5.shell to rerun the last commands and check what happened etc.

BuildError: Failed executing: xxxxxx
1. raise
2. ignore
3. backtrace
4. irb
5. shell
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?