5331 Commits

Author SHA1 Message Date
Mike McQuaid
d661cffc1f
Switch to using main as the default branch
Homebrew/brew has moved to a `main` default branch so we can more move
references from `master` to `main`.
2025-06-24 11:14:57 +01:00
Rylan Polster
f71287c4a9
Fix type mismatch in brew info 2025-06-17 16:57:50 -04:00
Mike McQuaid
c4c66d41ef
cmd: set typed: strict 2025-06-17 16:33:16 +01:00
Mike McQuaid
6fb115d342
Merge pull request #20099 from Homebrew/more_update_main_changes
cmd/update*: more fixes to allow migration from `master` to `main`.
2025-06-13 16:25:56 +00:00
Mike McQuaid
08eae94955
cmd/update*: more fixes to allow migration from master to main.
We're not migrating Homebrew/brew to `main` yet but this will allow us
to ensure we have a `brew update` ready in future when we're ready to do
this.
2025-06-13 17:13:51 +01:00
Mike McQuaid
af997ea2ad
Hide main branches from brew tap-info and brew info
These are basically as "default" as `master` now so we can hide them.
2025-06-13 12:09:02 +01:00
Peter Wu
770335f72e Remove unused --force-auto-update option
Remove the `brew tap --force-auto-update` option and the
`force_auto_update` configuration file option from Homebrew Bundles.

Fixes #19856
2025-06-12 14:16:12 +02:00
Mike McQuaid
837b28ba79
cmd/update: attempt migration from master to main branch.
This should allow any repositories that change from `master` to `main`
to be automatically migrated by `brew update` without requiring manual
intervention or displaying errors to the user.
2025-06-11 08:38:32 +01:00
Mike McQuaid
d2f9677cde
cmd/deps: add warning when not using runtime dependencies.
This should provide clarify as to why the output may differ from a
formula's declared dependencies.
2025-06-10 15:55:39 +01:00
Bo Anderson
57ed94c421
cmd/vendor-install: fix exit code handling for curl 2025-06-09 19:59:41 +01:00
Mike McQuaid
5fe43ed3f2
brew (bundle|) sh: use user's configuration but override prompts.
This was more painful that I expected but will allow `brew bundle sh`
and `brew sh` to use the user's configuration but use our custom prompt
for Bash and ZSH.
2025-06-05 15:43:34 +01:00
Mike McQuaid
e825ceea0a
Merge pull request #20041 from Homebrew/mcp_server
Add `brew mcp-server`: a MCP server for Homebrew.
2025-06-04 07:58:01 +00:00
Eric Knibbe
3dc9e88542
parser: show related env var in switch description 2025-06-03 13:57:42 -04:00
Mike McQuaid
f9471f9591
Add brew mcp-server: a MCP server for Homebrew.
Add a new `brew mcp-server` command for a Model Context Protocol (MCP)
server for Homebrew. This integrates with AI/LLM tools like Claude,
Claude Code and Cursor.

It currently supports the calls needed/used by the MCP Inspector and
Cursor (where I've tested it).

It provides as `tools` the subcommands output by `brew help` but should
be fairly straightforward to add more in future.

It is implemented in a slightly strange way (a standalone Ruby command
called from a shell command) as MCP servers need a faster startup time
than a normal Homebrew Ruby command allows and fail if they don't get
it.

There are a few Ruby libraries available but, given how relatively
simplistic the implementation is, it didn't feel worthwhile to use and
vendor them.
2025-06-03 15:22:33 +01:00
Bo Anderson
418a771d12
bundle: add support for selective cleanup 2025-05-23 06:19:01 +01:00
Eric Knibbe
28b1b74607
cmd/list: skip invalid Caskroom files 2025-05-15 11:48:36 -04:00
Bevan Kay
1c138a613b
cmd/upgrade: only ask about cask upgrade with --ask 2025-05-09 09:42:15 +10:00
Thibaut Hérault
3799c4b77d
Merge branch 'master' into master 2025-05-07 12:52:16 -04:00
thibhero
76e7a13332 applying brew tests, typecheck, style 2025-05-07 12:29:32 -04:00
thibhero
499a9b9dae changing to installed_formulae, as its checked if it should be installed 2025-05-07 12:08:46 -04:00
thibhero
f875dbc8a7 Implementing ask input with casks
renamed `ask` to `ask_formulae`
moving option `--ask` to work with formulae and casks
2025-05-07 12:07:29 -04:00
Patrick Linnane
c6a2fa335d
brew style --fix 2025-05-05 14:35:08 -07:00
thibhero
5013c17474 formatting correctly with brew style 2025-05-03 15:39:43 -04:00
thibhero
fd97539b9e Merge remote-tracking branch 'tyuwags/master' 2025-05-03 15:24:27 -04:00
thibhero
96ca8d2e07 displaying a warning if ask is used with casks 2025-05-03 15:23:42 -04:00
Bo Anderson
d3591482b2
cmd/services: change --max-wait default 2025-05-02 06:16:55 +01:00
thibhero
d19de85896 Setting HOMEBREW_ASK to nil in case it was set before 2025-04-30 23:50:07 -04:00
Mike McQuaid
0d86de5416
cmd/bundle: fix no_upgrade type.
If you set `HOMEBREW_BUNDLE_NO_UPGRADE=1`, `brew bundle check` will
output:

```
Error: Parameter 'no_upgrade': Expected type T::Boolean, got type String with value "1"
Caller: /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.5.12039/lib/types/private/methods/call_validation.rb:227
Definition: /opt/homebrew/Library/Homebrew/bundle/commands/check.rb:14 (Homebrew::Bundle::Commands::Check.run)
```
2025-04-28 12:13:53 +01:00
Carlo Cabrera
08d5ca0d01
brew style --fix 2025-04-24 16:34:36 +08:00
Carlo Cabrera
f3c25498f8
bundle/commands/exec: check that Brewfile is installed with --check
`brew bundle exec` behaves correctly only after doing `brew bundle install`.

Running `brew bundle check` can be slow, so let's add a `--check` flag
to `brew bundle exec` which will also run `brew bundle check` before
`brew bundle exec` to ensure that the `Brewfile` has been installed
before proceeding.
2025-04-24 16:34:23 +08:00
Mike McQuaid
60c047b5ea
Add HOMEBREW_BUNDLE_SERVICES variable to brew bundle
This allows another way to pass `--services` to `brew bundle`.
2025-04-23 17:20:14 +01:00
Mike McQuaid
89d0309b9c
Add brew bundle --upgrade-formulae
This flag allows you to specify formulae to upgrade, even if
`$HOMEBREW_BUNDLE_NO_UPGRADE` is set.

This is useful for upgrading specific formulae without upgrading all
formulae.

While we're here, let's add Sorbet signatures to the `Bundle` module
because I needed to add a new method there anyway.
2025-04-02 17:15:36 +01:00
Mike McQuaid
f54b4183a0
cmd/services: add named arguments.
This improves the generated completions.

Co-authored-by: Eric Knibbe <enk3@outlook.com>
2025-03-28 16:11:12 +00:00
Bo Anderson
650f62bcba
Fold brew bundle services into exec 2025-03-28 05:54:58 +00:00
Bo Anderson
c7e8b66da3
bundle: add --services flag for sh and exec 2025-03-28 05:54:57 +00:00
Bo Anderson
2b906e4fe3
services: support --file= in restart command 2025-03-28 05:21:08 +00:00
Bo Anderson
615fb764a1
Add brew bundle services helper 2025-03-28 05:21:07 +00:00
Bo Anderson
0b58e8fd37
services: add --keep flag 2025-03-28 05:21:05 +00:00
Carlo Cabrera
3c64c26535
Merge pull request #19620 from Homebrew/bootsnap-reset
Reset Bootsnap after installing gems
2025-03-27 18:47:11 +00:00
Mike McQuaid
5ec5063dc7
Add brew update-if-needed
This uses the logic in `brew.sh` for deciding whether or not to run
`brew update --auto-update` and makes it a dedicated command that can
be used instead of `brew update` in scripts to be really fast in the
no-op case.

`brew update` will always do at least some updating which is a nicer
default but is much slower.
2025-03-27 13:16:00 +00:00
Patrick Linnane
9821a7e896
fix new offenses
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2025-03-27 03:38:09 +00:00
Mike McQuaid
1ce12ae6e5
Merge pull request #19575 from Homebrew/brew_bundle_filtering
Don't filter the environment for `brew bundle (exec|env|sh)`
2025-03-25 09:07:39 +00:00
Mike McQuaid
07dd04efc4
Merge pull request #19577 from Homebrew/env_sync_strict
cmd/*env-sync: add `HOMEBREW_ENV_SYNC_STRICT` mode.
2025-03-25 02:51:26 +00:00
Mike McQuaid
61bb2f6225
cmd/*env-sync: add HOMEBREW_ENV_SYNC_STRICT mode.
If this variable is set, `brew *env-sync` will only sync the exact
installed versions of formulae rather than all the patch (or, for node,
minor and patch) versions.
2025-03-24 15:00:16 +00:00
Carlo Cabrera
f7ee1902e4
bundle: require more lazily
This will hopefully make using `brew bundle` a little bit snappier.
2025-03-24 22:48:58 +08:00
Mike McQuaid
6e20cedb67
Don't filter the environment for brew bundle (exec|env|sh)
It's both unexpected and undesirable for `brew bundle (exec|env|sh)` to
filter the environment and makes these tools less useful.

Not filtering the environment, though, causes issues with the
`brew bundle sh` shell. Fix this up and, while we're here, also improve
the formatting for both `zsh` and `bash` (the default) to use nicer and
more consistent prompts and colours.

To simplify this, consolidate some logic in a new
`Utils::Shell.shell_with_prompt` method and add tests for it and a
similar notice for `brew bundle sh`.

Finally, avoid printing out the notice when `HOMEBREW_NO_ENV_HINTS` is
set.
2025-03-24 13:37:25 +00:00
Mike McQuaid
e41a1f6d8a
Add brew install --as-dependency
This option avoids needing to immediately use
`brew tab --no-installed-on-request` when manually installing a
dependency.
2025-03-21 15:49:22 +00:00
Bo Anderson
72d47678c7
cmd/services: support passing multiple formulae 2025-03-21 03:48:44 +00:00
Mike McQuaid
d84fac5af4
Look for VSCode variants
We've had requests for this in Homebrew/bundle a few times so let's
implement it both for there and for `brew edit`.

Tested on my machine with `cursor` and working as expected.
2025-03-19 11:42:37 +00:00
Mike McQuaid
2fb3f35634
Merge pull request #19535 from Homebrew/services-run-file
Support `--file` for `brew services run`
2025-03-19 09:08:02 +00:00