Syntax for a Homebrew formula depending on a cask

1.9k Views Asked by At

I'm writing a homebrew formula for a project (https://www.cryfs.org). Since it is a file system, it depends on osxfuse, which is unfortunately only available as a cask. That is, the formula should have the cask as a dependency.

I tried the following

depends_on :cask => "osxfuse"

but I got the error message

Unsupported special dependency :cask

What is the syntax for adding casks as dependencies to a formula?

3

There are 3 best solutions below

2
Arnold Stoba On

Based on other formulas it seems like it needs to be depends_on cask: instead of :cask. There are multiple places where modules depend on a specific cask/macosx version and are defined as such: depends_on macos: "". Example of an cask dependency inside a cask formula.

depends_on cask: => "osxfuse"

Give me an heads up if it worked!

0
Paul Cav On

Have you tried:

depends_on "caskroom/cask/osxfuse"

0
Fabian Dörk On

Couldn't find an answer to this problem either.

But as a poor mans workaround this serves well for the time being:

def install
  # Resolve cask dependencies
  system "/usr/local/bin/brew", "cask", "install", "osxfuse"

The big disadvantage is obvious, its not a so much of dependency relation than an installation command. Which may lead to problems until you actually install the package.