Homebrew recipe without url

homebrew

Is it possible to create a Homebrew Formula that doesn't need a URL to download?

In my case the recipe just depends on other recipes and installs a homebrew specific shell script.

class Test < Formula
  desc "Test"
  homepage "https://test.com"
  version "1.0"

  depends_on "yschimke/tap/oksocial"

  def install
    (bin+"testoksocial").write <<-EOS.undent
        #!/bin/sh

        echo Hello
    EOS
  end
end

But running this gives

$ brew install ./test.rb
Error: formulae require at least a URL
Please report this bug:
    https://git.io/brew-troubleshooting
/usr/local/Library/Homebrew/formula.rb:193:in `determine_active_spec'

Best Answer

You have to use an url in your receipt, that's mandatory.

You don't have to use the http(s) url scheme, you can also use file:. If you don't need any content, you can use the /dev/null file. It can even have a checksum to silence the related warning.

url "file:///dev/null"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"