416 errors on brew (cask) install
Today I was trying to install MacTeX with homebrew and got this error output:
~ %> brew cask install mactex ==> Downloading http://mirror.ctan.org/systems/mac/mactex/mactex-20150613.pkg ######################################################################## 100.0% curl: (22) The requested URL returned error: 416 Error: Download failed on Cask 'mactex' with message: Download failed: http://mirror.ctan.org/systems/mac/mactex/mactex-20150613.pkg ~ %>
So frustrating! Then I remembered, I'd (successfully) started and cancelled an MacTeX installation a couple of days earlier, which, as it turns out, left an .incomplete file over in /Library/Caches/Homebrew. Homebrew's invocation of curl was detecting the .incomplete file and trying to do the smart thing by using a Range request to just grab the remainder (instead of starting from scratch). Unfortunately my local mirror doesn't seem to support Range requests, hence the 416 HTTP error (i.e., Range Not Satisfiable). So, easy fix:
~ %> rm -f /Library/Caches/Homebrew/mactex-*.pkg.incomplete ~ %>
Et voilà, problem solved and my 2.5G MacTeX download is proceeding apace. :)
(FWIW, when Apache vulnerabilities like CVE-2011-3192 cropped up a few years ago, it was pretty common for webservers to disable support for Range functionality altogether, which is what I'm imagining my local MacTeX mirror has done.)
I guess I should probably submit a patch to Cask to detect 416 errors and remove the offending .incomplete file automatically. Ahhh, yak shaving.















