Skip to content

Gem commands use system Ruby instead of project Ruby, causing ruby-lsp installation to fail #278

@gfguthrie

Description

@gfguthrie

I'm using chruby via direnv, and get the following error on macOS when the extension attempts to install ruby-lsp:

from extension "Ruby" version 0.16.10: Failed to install gem 'ruby-lsp': Gem command failed (status: 1)
Error: ERROR:  Error installing ruby-lsp:
    There are no versions of prism (>= 1.6.0) compatible with your Ruby & RubyGems.
    prism requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.

As I was messing about with my environment I would sometimes get a different error:

dlopen(.../.gem/ruby/3.4.8/gems/date-3.4.1/lib/date_core.bundle): Symbol not found: _rb_cFalseClass
Expected in: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby

I eventually just installed it myself to bypass the the extension attempting to install the gem and everything is now working correctly.

However, after looking at the code I believe these errors can be resolved by using worktree.which() in gemset.rs to find the correct ruby & gem executables first instead of just doing a bare execute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions