Skip to content

Ruby rdbg on macOS: "Installation of Ruby Debug failed", because the installer of a debug adapter doesn't run in the project directory #2295

Done

Description

@muescha

Problem

When a debug session of the ruby-rdbg template starts, LSP4IJ shows the notification "Installation of Ruby Debug failed", although rdbg is installed and the debug session itself works.

This was found while taking the screenshots for the Ruby page in #2294.

There is no way to see in the IDE why it failed:

  • The Installer tab of the debug window shows no output, also after clicking Check Installation.
  • idea.log has no entry for the installer or for the commands it ran.

Setup

  • macOS.
  • Ruby 4.0.9 and debug 1.11.1, installed with mise, set only for the project with a mise.toml (no global Ruby in mise).
  • LSP4IJ 0.30.2-SNAPSHOT, in IntelliJ IDEA 2026.3.1 Preview (started from JetBrains Toolbox) and in IntelliJ IDEA 2024.2 (started with ./gradlew runIde).
  • The ruby-rdbg installer runs rdbg --version as its check and gem install debug to install (installer.json).

Cause

The installer of a debug adapter runs its commands without a project, so not in the project directory:

  1. DebugAdapterServerInstallerBase.getProject() always returns null. The installer of a language server returns the project of its client (LanguageServerInstallerBase.getProject()).

  2. DeclarativeDebugAdapterServerInstaller creates the InstallerContext with that null project.

  3. Without a project and without a workingDir in installer.json, ExecTask.getWorkingDir returns null, and the command runs in the directory of the IDE process: / for an IDE started from the Dock or from Toolbox, or the directory ./gradlew runIde was started in.

  4. There, the rdbg shim of mise finds no mise.toml and no global Ruby, so the check fails:

    $ rdbg --version        # in /
    mise ERROR No version is set for shim: rdbg. Run `mise use -g [email protected]` to set a default, ...
    
  5. Then gem install debug runs, also outside the project. In the shell environment that the IDE loaded at its start, /usr/bin comes before the mise shims in PATH, so gem is the system Ruby 2.6 of macOS (gem env gemdir → /Library/Ruby/Gems/2.6.0). debug needs Ruby 2.7 or later, and that directory isn't writable without sudo, so the installation fails.

The same two commands succeed in the project directory, with the same environment:

$ rdbg --version        # in the project directory
rdbg 1.11.1
$ gem --version         # in the project directory, shims first in PATH
4.0.20

The debug session works anyway, because with the attach configuration LSP4IJ doesn't start rdbg: it was started in a terminal, in the project directory.

Who is affected

Every debug adapter template whose check or installation depends on the project directory, for example with a tool version set per project by mise, asdf, rbenv, pyenv or nvm (mise.toml, .tool-versions, .ruby-version, .python-version, .nvmrc). Language server templates are not affected, because their installer gets the project.

Does this happen to others?

Has anybody else seen "Installation of … failed" for a debug adapter whose tool is installed per project? On Windows, and with other version managers than mise, this is not tested.

Proposal

  • Give the installer of a debug adapter the project of the run configuration or debug session, so its commands run in the project directory, like the installer of a language server.
  • Independent of that, log what the installer runs, see "Related".

Related

A general proposal to log every installer run (commands, PATH, exit codes and output, in the Installer tab and in idea.log) follows in a separate issue. With such a log, this problem could have been analyzed from the IDE.

Pair-programmed with ❤️ by @muescha and ⚙️ by 🤖 Claude Code

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions