Homebrew/homebrew-cask · warning

No running instances of Trader Workstation found

Error message

No running instances of Trader Workstation found

What it means

Printed by the terminate_process step in trader-workstation's uninstall_preflight_steps (Casks/t/trader-workstation.rb:39). Before uninstalling, Homebrew expands the `{{appdir}}` template and runs `/usr/bin/pkill -f <appdir>/Trader Workstation/Trader Workstation.app` (attempts defaults to 1 here) to stop IBKR's Java-based Trader Workstation so the bundled uninstaller script can run cleanly. pkill exits non-zero when no running process's command line matches — i.e. the app simply is not running — and Homebrew then prints this failure_message as a `Warning:`. With `must_succeed: false` the uninstall always proceeds; despite the phrasing, this message means 'nothing had to be stopped', not an error.

Source

Thrown at Casks/t/trader-workstation.rb:39

    end
  end

  auto_updates true
  depends_on :macos

  installer script: {
    executable: "#{staged_path}/Trader Workstation Installer.app/Contents/MacOS/JavaApplicationStub",
    args:       [
      "-dir", "#{appdir}/Trader Workstation",
      "-q"
    ],
  }

  uninstall_preflight_steps do
    terminate_process "{{appdir}}/Trader Workstation/Trader Workstation.app",
                      match: :full, must_succeed: false,
                      notices: ["Stopping all running instances of Trader Workstation prior to uninstall"],
                      failure_message: "No running instances of Trader Workstation found"
  end

  uninstall quit:   "com.install4j.5889-6375-8446-2021",
            script: {
              executable: "#{appdir}/Trader Workstation/Trader Workstation Uninstaller.app/Contents/MacOS/JavaApplicationStub",
              args:       ["-q"],
            }

  zap trash: [
    "#{appdir}/Trader Workstation",
    "~/Applications/Trader Workstation",
    "~/Jts",
    "~/Library/Application Support/Trader Workstation",
  ]
end

View on GitHub (pinned to 8587086220)

Solutions

  1. No action needed in the common case: the message states that no running instances were found, and `must_succeed: false` lets the uninstall continue — verify with `brew list --cask trader-workstation` afterwards.
  2. If TWS actually is running, quit it first (`osascript -e 'quit app "Trader Workstation"'` or `pkill -f 'Trader Workstation.app'`) so the install4j uninstaller is not blocked, then re-run `brew uninstall --cask trader-workstation`.
  3. If you use a custom appdir, confirm with `pgrep -fl 'Trader Workstation'` that the running process path matches the cask's expanded `{{appdir}}` template.
  4. Do not retry the uninstall solely because of this warning; check exit status and `brew list --cask` instead.

Example fix

# before
brew uninstall --cask trader-workstation
# Warning: No running instances of Trader Workstation found

# after: only stop something if it is really running, then uninstall
pgrep -fl 'Trader Workstation' && pkill -f 'Trader Workstation.app'
brew uninstall --cask trader-workstation
Defensive patterns

Strategy: validation

Validate before calling

# Check whether anything actually needs stopping before uninstalling:
if pgrep -fl 'Trader Workstation'; then pkill -f 'Trader Workstation.app'; sleep 1; fi
brew uninstall --cask trader-workstation  # the warning when idle is expected and harmless

Try / catch

begin
  Homebrew::SystemCommand.run!("/usr/bin/pkill",
    args: ["-f", "#{appdir}/Trader Workstation/Trader Workstation.app"])
rescue ErrorDuringExecution
  # Expected whenever TWS is not running: pkill exits 1 on no match.
  warn "No running instances of Trader Workstation found"
end

Prevention

When it happens

Trigger: `brew uninstall --cask trader-workstation` (or zap) while Trader Workstation is not running: the single pkill attempt matches no process, exits 1, and the 'No running instances ... found' warning is printed before the quit/uninstaller steps run. It also fires if TWS runs under a command line that does not literally contain the expanded appdir path (custom --appdir, renamed bundle).

Common situations: Routine uninstall on a machine where TWS was already closed — the expected, harmless case; installs to a non-default appdir making the expanded path differ from the running Java process's command line; slow-starting JVM appearing after the single attempt.

Related errors


AI-assisted analysis of Homebrew/homebrew-cask@8587086220 (2026-08-21). Data as JSON: /api/errors/84e0d92da5c72193. Report an issue: GitHub.