How to brew install a formula using local copy of source instead of the formula's url?

Solution 1:

If this is a infrequent problem limited to some domains then you can edit the formula to specify a file URL (your wiki link is broken, so not sure if this is what you have already discovered).

$ brew edit trash
$ git -C $(brew --repo) diff
diff --git a/Library/Formula/trash.rb b/Library/Formula/trash.rb
index c35d197..84fbbd7 100644
--- a/Library/Formula/trash.rb
+++ b/Library/Formula/trash.rb
@@ -1,7 +1,7 @@
 class Trash < Formula
   desc "CLI tool that moves files or folder to the trash"
   homepage "http://hasseg.org/trash/"
-  url "https://github.com/ali-rantakari/trash/archive/v0.8.5.tar.gz"
+  url "file:///tmp/v0.8.5.tar.gz"
   sha256 "1e08fdcdeaa216be1aee7bf357295943388d81e62c2c68c30c830ce5c43aae99"

   conflicts_with "osxutils", :because => "both install a trash binary"
$ brew install trash