Skip to content

Unable to migrate Formula-to-Cask within the same tap #21207

@philrz

Description

@philrz

brew doctor output

$ brew doctor
Your system is ready to brew.

Verification

  • I ran brew update twice and am still able to reproduce my issue.
  • My "brew doctor output" above says Your system is ready to brew or a definitely unrelated Tier message.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

$ brew config
HOMEBREW_VERSION: 5.0.5
ORIGIN: https://github.com/Homebrew/brew
HEAD: 70badad488056fb48cf687aa777f2880aac58fe9
Last commit: 2 days ago
Branch: stable
Core tap JSON: 10 Dec 00:59 UTC
Core cask tap JSON: 10 Dec 00:59 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: ["--no-quarantine"]
HOMEBREW_DOWNLOAD_CONCURRENCY: 6
HOMEBREW_FORBID_PACKAGES_FROM_PATHS: set
HOMEBREW_MAKE_JOBS: 3
HOMEBREW_NO_AUTO_UPDATE: set
HOMEBREW_NO_INSTALL_CLEANUP: set
Homebrew Ruby: 3.4.7 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.4.7/bin/ruby
CPU: 3-core 64-bit dunno
Clang: 17.0.0 build 1700
Git: 2.52.0 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.7.2-arm64
CLT: 16.4.0.0.1.1747106510
Xcode: 16.4 => /Applications/Xcode_16.4.app/Contents/Developer
Rosetta 2: false

What were you trying to do (and why)?

I'm trying to migrate users of an older Formula to a newer Cask in a one-shot operation. It's my understanding this functionality was enabled in #20800 and specifically the tap_migrations.json config described here would have allowed this, but per my repro steps it did not seem to work.

What happened (include all command output)?

Starting from a state where the old Formula has been removed from the repo and the tap_migrations.json added to the repo, a brew upgrade returns no output. The binary associated with the old Formula remains installed.

What did you expect to happen?

I expected the binary associated with the old Formula to be removed and the binary associated with the Cask to be installed in its place.

Step-by-step reproduction instructions (by running brew commands)

The personal/scratch repo I'm using for repro is https://github.com/philrz/homebrew-tap.

As prep steps, this old super.rb Formula is installed on the host when no tap_migrations.json is yet present in the repo. This is the starting state I expect my production target users will be starting from. The super version string shown below is indicative of the binary from the old Formula being present.

$ brew install philrz/tap/super
==> Tapping philrz/tap
Cloning into '/opt/homebrew/Library/Taps/philrz/homebrew-tap'...
remote: Enumerating objects: 368, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 368 (delta 0), reused 1 (delta 0), pack-reused 364 (from 2)
Receiving objects: 100% (368/368), 42.55 KiB | 495.00 KiB/s, done.
Resolving deltas: 100% (168/168), done.
Tapped 1 cask and 1 formula (18 files, 67.2KB).
Warning: Treating philrz/tap/super as a formula. For the cask, use philrz/tap/super or specify the `--cask` flag. To silence this message, use the `--formula` flag.
==> Fetching downloads for: super
✔︎ Bottle Manifest [email protected] (1.24.11)                                    [Downloaded    7.5KB/  7.5KB]
✔︎ Formula super (4130d71)                                              [Verifying     6.4MB/  6.4MB]
✔︎ Bottle [email protected] (1.24.11)                                             [Downloaded   77.7MB/ 77.7MB]
==> Installing super from philrz/tap
==> Installing philrz/tap/super dependency: [email protected]
==> Pouring [email protected]_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/[email protected]/1.24.11: 14,123 files, 256.0MB
==> GOPATH=$PWD/build go install github.com/brimdata/super/cmd/super@4130d71
🍺  /opt/homebrew/Cellar/super/4130d71: 7 files, 68.9MB, built in 1 minute 10 seconds

$ super -version
Version: v0.0.0-20250819180341-4130d7106717

At this point I remove the old super.rb Formula from the repo and add the tap_migrations.json to the repo. This represents the change I'd make when I want to users to be migrated from Formula to Cask as part of normal Homebrew update+upgrade workflow. With the repo in that updated state, as a user I do:

$ brew update
==> Updating Homebrew...
Updated 1 tap (philrz/tap).
No changes to formulae or casks.

$ brew upgrade

$ super -version
Version: v0.0.0-20250819180341-4130d7106717

As you can see, the brew upgrade generated no output, indicating there was no action taken due to the tap having been updated with what I was led to understand is the appropriate config to migrate this user to the Cask. The fact the old super version string is still present is further validation that nothing changed regarding the installed binary.

At this point, as a user I can force my way onto the Cask by manually doing:

$ brew remove super
Warning: Treating super as a formula. For the cask, use philrz/tap/super or specify the `--cask` flag. To silence this message, use the `--formula` flag.
Uninstalling /opt/homebrew/Cellar/super/4130d71... (7 files, 68.9MB)
==> Autoremoving 1 unneeded formula:
[email protected]
Uninstalling /opt/homebrew/Cellar/[email protected]/1.24.11... (14,123 files, 256.0MB)

$ brew install --cask philrz/tap/super
==> Downloading https://super-prereleases.s3.us-east-2.amazonaws.com/8012b6d/super-8012b6d.darwin-ar
############################################################################################# 100.0%
==> Installing Cask super
Warning: --no-quarantine bypasses macOS’s Gatekeeper, reducing system security. Do not use this flag unless you understand the risks.
==> Linking Binary 'super' to '/opt/homebrew/bin/super'
🍺  super was successfully installed!

$ super -version
Version: 8012b6d

That final super version string is indicative of now having the binary associated with the Cask installed. But this is effectively what I'd been hoping the result would have been when I ran brew upgrade after the migration config had been put in place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedWe want help addressing this

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions