Search code examples
rubyhomebrewrecipe

homebrew: the difference between `prefix.install "some_binary"` and `bin.install "some_binary"`


When writing a homebrew recipe,

whats the difference between prefix.install "some_binary" and bin.install "some_binary"


Solution

  • Read the Formula Cookbook:

    prefix  #{HOMEBREW_PREFIX}/Cellar/#{name}/#{version}
            /usr/local/Cellar/foo/0.1
    
    bin     #{prefix}/bin
            /usr/local/Cellar/foo/0.1/bin 
    

    Here, bin is the directory where the actual executables are stored, whereas prefix contains everything related to a given version of the formula.

    You don't want to install a binary in the directory pointed at by prefix.