How to do downgrade watchman version using home-brew in macOS?

1.8k Views Asked by At

I am trying to downgrade the latest watchman version to previous version. I tried to follow source code replacement method but it dosen't work for me. Below are me my system configurations

System:
    OS: macOS 12.4
    CPU: (6) x64 Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz
    Memory: 59.54 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 17.9.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.5.5 - /usr/local/bin/npm
    Watchman: 2022.07.04.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      API Levels: 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32
      Build Tools: 26.0.2, 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 31.0.0, 31.0.0
      System Images: android-29 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom
      Android NDK: 22.1.7171670
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_252 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: ^0.68.0 => 0.68.0 
1

There are 1 best solutions below

0
Toma Bourov On

While installing packages with HomeBrew might be easy, unfortunately, there isn't an out-of-the-box simple solution to downgrading.


Scenario 1

If the older version of watchman you’re looking to switch back to has been installed by Homebrew in the past, you’re lucky. You can see which versions are locally available by issuing:

brew info watchman

Pick one of the existing local versions and switch to it via:

brew switch watchman <version>

DONE!


Scenario 2

This is where things get a little more involving. Since Homebrew doesn’t provide a command to arbitrarily select a version to install, you have to manually find the version you need in Homebrew’s GitHub repository, copy the URL to it and pass it as an argument for manual installation.

Step 1

Go to https://github.com/Homebrew/homebrew-core/find/master and type the name of the package you are looking for (watchman in your case):

GitHub Homebrew page

Select the one ending in .rb!

Step 2

Click on History and find the version you are trying to downgrade to.

enter image description here

When you find the desired version, click on the Commit ID to view the details. (I will be using fcd0342 as an example)

Step 3

Click on the 3 dots and select View File

enter image description here

Step 4

Click on RAW and copy the URL

enter image description here

Step 5

Once you have the URL, execute this command:

brew install <raw-url>

Cheers