rubyrubygemsruby-lsp

ruby-lsp with rbenv failing to execute


I'm having a problem with installing and trying to use ruby-lsp.

I think I followed the correct steps, but keep getting an error:

  1. Be sure I have selected the correct ruby version:
❯ rbenv versions
  system
  2.7.4
  3.1.3
* 3.1.4 (set by /Users/myuser/.rbenv/version)
  3.2.1
  3.2.2
  1. Install the gem:
❯ gem install ruby-lsp
Successfully installed ruby-lsp-0.8.0
Ignoring debug-1.7.2 because its extensions are not built. Try: gem pristine debug --version 1.7.2
Parsing documentation for ruby-lsp-0.8.0
Done installing documentation for ruby-lsp after 0 seconds
1 gem installed
  1. Be sure it's listed:
❯ gem list ruby-lsp

*** LOCAL GEMS ***

ruby-lsp (0.8.0, 0.7.6, 0.4.4)
  1. Rehash, just in case (rbenv rehash)

  2. Run:

❯ ruby-lsp
rbenv: ruby-lsp: command not found

The `ruby-lsp' command exists in these Ruby versions:
  3.2.2

I don't get why it's present in only one version of Ruby.

Any ideas?

Thanks


Solution

  • Simply a missing setting: from a previous installation I had no Gem bin path in the PATH variable, so my problem was fixed by adding this to the .bashrc file:

    # $GEM_HOME already defined
    export PATH=$PATH:$GEM_HOME/bin