-
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
-
Download the raw formula to disk:
cd ~/Desktop curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/9e6e6a1ca8551901bff69d329c7fbb9007064134/Formula/composer.rb
-
Install that recipe from disk:
brew install composer.rb
(changecomposer.rb
to the formula name) -
Clean up:
rm composer.rb
(changecomposer.rb
to the formula name) -
Check the version for whatever you just installed:
❯ composer --version Composer version 1.10.15 2020-10-13 15:59:09
-
-
Save nickcernis/c0567853fb6ddea6c41804d924822c49 to your computer and use it in GitHub Desktop.
@IgnacioAgustinCabral For formulae written for an older version of homebrew, you may now need to edit the recipe manually before it will install.
For composer 1.10.8, downloading the composer.rb
file and then editing it to comment out bottle :unneeded
works for me (I'm also on an Apple silicon/M-series Mac on Sonoma):
- bottle :unneeded
+# bottle :unneeded
I'm then able to install with the --formula
flag:
> brew install --formula composer.rb
==> Fetching composer
==> Downloading https://getcomposer.org/download/1.10.8/composer.phar
##################################################################################################################################################################################### 100.0%
Warning: composer 2.6.6 is available and more recent than version 1.10.8.
🍺 /opt/homebrew/Cellar/composer/1.10.8: 3 files, 1.9MB, built in 1 second
==> Running `brew cleanup composer`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/[myusername]/Library/Caches/Homebrew/composer--1.10.8.phar... (1.9MB)
Composer then shows version 1.10.8, albeit with deprecation warnings, presumably due to my system's PHP version (I'm using 8.3.1):
> composer --version
PHP Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///opt/homebrew/Cellar/composer/1.10.8/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112
Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///opt/homebrew/Cellar/composer/1.10.8/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112
Composer version 1.10.8 2020-06-24 21:23:30
@nickcernis this worked perfectly i'm quite new to brew and MacOs, thanks for replying and helping!
@IgnacioAgustinCabral You're welcome! Glad it worked out.
This worked for me, thanks.
I made some notes about how to do this for a specific cask at https://gist.github.com/jpluimers/8da7d1f366936b0363e98b8baef1af98
Sadly it doesnt work on my Mac M1 Sonoma 14.2.1
followed the same instructions but with composer 1.10.8