On an Apple Silicon machine, running brew install homebrew/cask/android-studio (or brew reinstall) generates a temporary file with a filename that's longer than the OS limit. This causes an error below
Error: Download failed on Cask 'android-studio' with message: File name too long @ dir_s_rmdir - /opt/homebrew/var/homebrew/locks/80881f74c413c8e986cfefc7dd5c817a51af72e9d57a02e847fd55415ddab7ed--android-studio-2021.1.1.20-mac_arm.dmg?mh=5P&pl=19&shardbypass=yes&redirect_counter=1&cm2rm=sn-h5boxu-q0ce7s&req_id=2d9c9c9e4dcb0005&cms_redirect=yes&mip=213.79.62.112&mm=42&mn=sn-q0c7rn76&ms=onc&mt=1643899250&mv=m&mvi=3.incomplete.lock
A lot of characters in the filename seem to come from query params after the URL redirection.
Command that failed
brew install homebrew/cask/android-studio
Output of command with --verbose --debug
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-cask/android-studio.rb
==> Cask::Installer#reinstall
==> Cask::Installer#install
==> Printing caveats
==> Cask::Installer#fetch
/opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/3.3.13-44-g8e97f60\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 12.2\)\ curl/7.77.0 --header Accept-Language:\ en --retry 3 --location --silent --head --request GET https://redirector.gvt1.com/edgedl/android/studio/install/2021.1.1.20/android-studio-2021.1.1.20-mac_arm.dmg
Error: Download failed on Cask 'android-studio' with message: File name too long @ dir_s_rmdir - /opt/homebrew/var/homebrew/locks/80881f74c413c8e986cfefc7dd5c817a51af72e9d57a02e847fd55415ddab7ed--android-studio-2021.1.1.20-mac_arm.dmg?mh=5P&pl=19&shardbypass=yes&redirect_counter=1&cm2rm=sn-h5boxu-q0ce7s&req_id=ba0368e6842de51e&cms_redirect=yes&mip=213.79.62.112&mm=42&mn=sn-q0cedn7s&ms=onc&mt=1643900210&mv=m&mvi=3.incomplete.lock
/opt/homebrew/Library/Homebrew/download_strategy.rb:430:in `unlink'
/opt/homebrew/Library/Homebrew/download_strategy.rb:430:in `unlink'
/opt/homebrew/Library/Homebrew/download_strategy.rb:430:in `ensure in fetch'
/opt/homebrew/Library/Homebrew/download_strategy.rb:430:in `fetch'
/opt/homebrew/Library/Homebrew/cask/download.rb:25:in `fetch'
/opt/homebrew/Library/Homebrew/cask/installer.rb:178:in `download'
/opt/homebrew/Library/Homebrew/cask/installer.rb:74:in `fetch'
/opt/homebrew/Library/Homebrew/cask/installer.rb:105:in `install'
/opt/homebrew/Library/Homebrew/cask/installer.rb:149:in `reinstall'
/opt/homebrew/Library/Homebrew/cask/cmd/reinstall.rb:48:in `block in reinstall_casks'
/opt/homebrew/Library/Homebrew/cask/cmd/reinstall.rb:47:in `each'
/opt/homebrew/Library/Homebrew/cask/cmd/reinstall.rb:47:in `reinstall_casks'
/opt/homebrew/Library/Homebrew/cmd/reinstall.rb:154:in `reinstall'
/opt/homebrew/Library/Homebrew/brew.rb:110:in `<main>'
Verification
--force
.brew update-reset && brew update
and retried my command.brew doctor
, fixed as many issues as possible and retried my command.Description of issue
On an Apple Silicon machine, running
brew install homebrew/cask/android-studio
(orbrew reinstall
) generates a temporary file with a filename that's longer than the OS limit. This causes an error belowA lot of characters in the filename seem to come from query params after the URL redirection.
Command that failed
brew install homebrew/cask/android-studio
Output of command with
--verbose --debug
Output of
brew doctor --verbose
Output of
brew tap