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

        echo Hello

But running this gives

$ brew install ./test.rb
Error: formulae require at least a URL
Please report this bug:
/usr/local/Library/Homebrew/formula.rb:193:in `determine_active_spec'
  • 1
    brew is a package manager. What is it you're actually wanting your formula to do? – Alistair McMillan Jun 26 '16 at 1:10
  • Install a command (shell script), that has dependencies on other homebrew targets. I can put the scripts in the tarball, but if I need to rewrite them during installation e.g. based on optional dependencies then the archive seems pointless given the recipe can write out the command. – Yuri Schimke Jun 26 '16 at 1:17

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"

I got it working by creating an empty tar file and linking to that. But I'm curious if there are better ways.

$ tar cvf empty.tar --files-from /dev/null
  • That might "work" but I'm not sure if the brew developers would accept that formula if you submitted it to them. Probably better asking on GitHub here rather than on Ask Different. – Alistair McMillan Jun 26 '16 at 1:21
  • 1
    It's for a private tap, not something I intend for the public repo. Internal company tools etc. – Yuri Schimke Jun 26 '16 at 1:35
  • I'm trying to do the same thing. I want to create a private tap for internal tools, and some of them are simple bash scripts that seem like they could just live in the tap repo. What did you end up doing? – Jim B. Apr 27 '20 at 23:16
  • I think answer above this using /dev/null is probably the best option for now – Yuri Schimke Apr 28 '20 at 7:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .