How do I downgrade a package on homebrew?

Viewed 691

Not too familiar with homebrew. I'm trying to downgrade jq from 1.6 to 1.3.1 by running

brew install jq@1.3.1

but I keep receiving

Warning: No available formula with the name "jq@1.3.1".
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

as my error response.

I've tried brew install jq@1.3, brew install jq=1.3, brew install jq==1.3 to no avail. Any advice?

1 Answers

jq 1.3 is available via homebrew, but AFAICT, a version specifically tagged 1.3.1 is not. (See e.g. https://stedolan.github.io/jq/download )

One way to fetch a specific version is as follows:

  1. First you'll probably want to uninstall jq:
brew uninstall jq
  1. Find a suitable jq.rb e.g. by browsing https://github.com/Homebrew/homebrew-core/commits/master/Formula/jq.rb

For jq 1.3 the following would suffice:

URL=https://github.com/Homebrew/homebrew-core/blob/9517da4a73f8eb9af8c8c217a52526f5edf428a2/Formula/jq.rb
  1. Fetch and execute the script
wget $URL  # or use curl

brew install -s jq.rb
Related