Skip to content

Improve error when preventing install formula from local file #20441

Description

@UndefBehavior

Verification

Provide a detailed description of the proposed feature

There is no information about a error in executing brew install /path/to/formula.rb except "There is no formula in /path/to/formula". It will be useful to add info about HOMEBREW_DEVELOPER environment variable in case of guessing path in user's input.

What is the motivation for the feature?

I spent 2 hours to make command working which I debug yesterday. I couldn't find any info except brew version mismatch between my macbook and the other one.

How will the feature be relevant to at least 90% of Homebrew users?

90% of Homebrew users don't make formulas so...

What alternatives to the feature have been considered?

More documentation I guess.

Activity

  1. UndefBehavior commented on Aug 13, 2025

    @UndefBehavior
    Author

    The commit with the new behavior: e22af1138883c892d585e215c05f63213df41050

  2. MikeMcQuaid commented on Aug 13, 2025

    @MikeMcQuaid
    Member

    It will be useful to add info about HOMEBREW_DEVELOPER environment variable in case of guessing path in user's input.

    We won't provide the environment variable as documentation as you specifically should not set it as a workaround as it changes a lot of the behaviour of Homebrew in ways you probably don't want.

    I agree the error message here should/could be improved.

  3. changed the issue type fromtoon Aug 13, 2025
  4. changed the title [-]Add hint about preventing install formula from local file with HOMEBREW_DEVELOPER[/-] [+]Improve error when preventing install formula from local file[/+] on Aug 13, 2025
  5. fasmat commented on Aug 13, 2025

    @fasmat

    @MikeMcQuaid thanks for tagging me to this issue. The change broke my CI for my personal homebrew repository where I check the casks to see if the pass style checks and can be installed and uninstalled. The changes in PR #20414 broke my workflow and I fixed it by setting HOMEBREW_DEVELOPER here: https://github.com/fasmat/homebrew-trader-workstation/blob/main/.github/workflows/main.yml#L16-L17

    What would have been the correct fix to make for instance these step work correctly after the change? (all changes below are the same for other casks)

    https://github.com/fasmat/homebrew-trader-workstation/blob/01d489dbb44ef8ec26cbf6dec5685e0d78f0eb43/.github/workflows/main.yml#L26-L51

  6. MikeMcQuaid commented on Aug 13, 2025

    @MikeMcQuaid
    Member

    @fasmat Hopefully improving the error messages/instructions in #20444. the TL;DR is ensure that you're putting the formula and/or casks into a tap directory and that you're not referencing them by path but by name.

    Can't debug your workflow specifically but it may be worth seeing if the change is still required after #20444 is merged. Hope that helps!

  7. fasmat commented on Aug 13, 2025

    @fasmat

    @MikeMcQuaid I'm not sure I know what to do now? My current workflow for a PR is:

    • git checkout pr-branc
    • brew style check path/to/formula (still works)
    • brew audit path/to/formula (fails)
    • brew install path/to/formula (fails)

    how would this work with the changes? If I just

    • brew tap repository
    • brew style check/audit/install formula

    I do not install the formula from the feature branch but from main?

  8. Rylan12 commented on Aug 13, 2025

    @Rylan12
    Contributor

    @fasmat say I have a custom formula called myformula in a tap called my/tap.

    Running brew install my/tap/myformula will use the contents of the file located at $(brew --repository my/tap)/Formula/myformula.rb. Homebrew will not change the branch of your tap, it will simply use the file at that location.

    A better place to ask for specific help might be our discussions forum, where there is a "Tap maintenance and brew development" category

  9. fasmat commented on Aug 13, 2025

    @fasmat

    @Rylan12 thank you for your response. I'm using this inside a GitHub workflow for pull request to my tap:

    • I'm using action/checkout to checkout the branch that I'm testing
    • I'm running e.g. brew install ./Cask/formula to check if the updated formula still installs successfully

    I managed to find a workflow around this but this seems quite convoluted compared to how easy it was before:

    - name: Link to homebrew and install tap 
      run: |
        mkdir -p "$(brew --repo ${{ github.repository }})"
        rm -rf "$(brew --repo ${{ github.repository }})"
        ln -s "$GITHUB_WORKSPACE" "$(brew --repo ${{ github.repository }})"
    
        brew style --cask my-cask
        brew audit --cask --online --strict my-cask
        brew install --cask my-cask
        brew uninstall --cask my-cask

    The soft linking wasn't required before... But I guess this solves the issue without needing to set HOMEBREW_DEVELOPER.

  10. MikeMcQuaid commented on Aug 14, 2025

    @MikeMcQuaid
    Member

    @fasmat I think the issue is you're using both actions/checkout and Homebrew/actions/setup-homebrew. The latter will check out your tap for you and do all that symlinking. Give it a try.

  11. MikeMcQuaid commented on Aug 14, 2025

    @MikeMcQuaid
    Member

    @fasmat I'm continuing to improve this in #20457, bear with me and apologies for the disruption.

  12. MikeMcQuaid commented on Aug 14, 2025

    @MikeMcQuaid
    Member

    @fasmat actions/checkout should still be unneeded but as-of #20457 things should work either way. If things are still broken for you: please shout and I'll fix.

  13. fasmat commented on Aug 14, 2025

    @fasmat

    @MikeMcQuaid thanks you for your efforts!

    I managed to get the workflow running as you said without having to link the workspace folder manually as tap 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions