Skip to content

Instantly share code, notes, and snippets.

@nickcernis
Last active March 4, 2024 23:49
Show Gist options
  • Save nickcernis/c0567853fb6ddea6c41804d924822c49 to your computer and use it in GitHub Desktop.
Save nickcernis/c0567853fb6ddea6c41804d924822c49 to your computer and use it in GitHub Desktop.
Install an old version with homebrew for macOS
  1. Find the formula for the version you want to install:

    • Visit https://github.com/Homebrew/homebrew-core/tree/master/Formula
    • Click the file with your formula (e.g. “composer.rb”)
    • Click “History” (top right)
    • Click the commit hash for the version you want to download
    • Click the three dots (top right of diff) and choose “view file”
    • Click “Raw” and copy the raw URL from the browser address bar.

    For example, composer 1.10.15 lives here: https://github.com/Homebrew/homebrew-core/blob/9e6e6a1ca8551901bff69d329c7fbb9007064134/Formula/composer.rb

    With the raw file at: https://raw.githubusercontent.com/Homebrew/homebrew-core/9e6e6a1ca8551901bff69d329c7fbb9007064134/Formula/composer.rb

  2. Download the raw formula to disk:

    cd ~/Desktop
    curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/9e6e6a1ca8551901bff69d329c7fbb9007064134/Formula/composer.rb
  3. Install that recipe from disk:

    brew install composer.rb (change composer.rb to the formula name)

  4. Clean up:

    rm composer.rb (change composer.rb to the formula name)

  5. Check the version for whatever you just installed:

    ❯ composer --version
    Composer version 1.10.15 2020-10-13 15:59:09
@IgnacioAgustinCabral
Copy link

@nickcernis this worked perfectly i'm quite new to brew and MacOs, thanks for replying and helping!

@nickcernis
Copy link
Author

@IgnacioAgustinCabral You're welcome! Glad it worked out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment