Search code examples
macoshomebrewswiftlint

How could I downgrade the swiftlint on my m1 pro mac


I want to downgrade the swiftlint version on my MBP M1 Pro.
I installed it using brew install swiftlint
In homebrew/Cellar/swiftlint the folder is 0.49.1 which I guess is the version installed on my machine.

I googled and tried a few methods. But non of them worked for me.

First: brew install <url of older github raw file> is not working

Second: brew install [email protected] was also not working

Third:

  • I downloaded portable_zip of 0.47.0 form github, extracted and created a new folder homebrew/Cellar/swiftlint/0.47.0 and pasted the content there. After double clicking on the executable file swiftlint starts running.
  • Then ran brew switch swiftlint 0.47.0 but it was also not working
  • I also tried deleting the alias from homebrew/bin/swiftlint and pasted new alias from homebrew/Cellar/swiftlint/0.47.0 folder's executable there, but it was also not working.

Can anyone help me out what I am doing wrong, and what should be the correct steps.
I am new to macOS.


Solution

  • I have found a work around. Earlier I wasn't aware how files, applictions works in MacOS, where does the data for applications go.

    I am writing down the steps for swiftlint, maybe similar steps might be used to downgrade any other tool on MacOS (on M1 pro macbook).

    What worked for me was:

    • First of all I installed xcode's older version manually, xcode-select --print-path was different so I changed it with sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer.
    • Then I uninstalled the swiftlint using brew uninstall command.
    • Then from github I downloaded .pkg file of exact version I wanted, and installed it.
    • Also downloaded portable zip from same repository and extracted the contents and pasted them in homebrew/Cellar/swiftlint/
    • Made one alias of executable file of the previous step extracted files and pasted that in homebrew/bin

    Then this exact version of swiftlint was installed for me, and now it works fine.
    Hope this helps someone.