Open zachschultz opened 1 year ago
I also have macOS and use rbenv
.
The only solution I have come up with is to set the "global" ruby version to 3.2.2:
rbenv global 3.2.2
This way, Mason uses that version to install rubocop
and solargraph
.
@docwhat that worked, thank you!
This isn't a great solution, alas, as it can't take the Gemfile
into account to get the right versions, etc.
I ran into this same issue (on macOS 14.3.1) with this error in the :Mason
UI:
(1) All (2) LSP (3) DAP (4) Linter (5) Formatter
Language Filter: press <C-f> to apply filter
Failed
◍ rubocop
▼ Displaying full log
Installing gem rubocop@1.62.0…
Successfully installed unicode-display_width-2.5.0
Successfully installed ruby-progressbar-1.13.0
Building native extensions. This could take a while...
ERROR: Error installing rubocop:
rubocop-ast requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.
Successfully installed racc-1.7.3
Successfully installed ast-2.4.2
Successfully installed parser-3.3.0.5
[debug] Installation directory retained at "/Users/cmoel/.local/share/nvim/mason/staging/rubocop".
spawn: gem failed with exit code 1 and signal 0.
Instead of rbenv global 3.2.2
, I navigated to ~/.local
and ran rbenv local 3.3.0
and installing rubocop
worked:
(1) All (2) LSP (3) DAP (4) Linter (5) Formatter
Language Filter: press <C-f> to apply filter
Installed
◍ rubocop
Needing to set the ruby version in ~/.local
doesn't feel like a great, but it feels like a slight improvement over setting it globally. I'd guess it could be set in ~/.local/share/nvim/mason
to be more precise but I haven't tried it yet.
None of these work for me fully. Mason fails to update ruby-lsp
because it's trying to use the default system version of Ruby (2.6.10.210):
Failed (1)
✗ ruby-lsp
▼ Displaying full log
Installing gem ruby-lsp@0.17.9…
ERROR: Error installing ruby-lsp:
sorbet-runtime requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.
spawn: gem failed with exit code 1 and signal 0.
However, prior to this, I had already properly installed ruby-lsp
version 0.17.7 under a different Ruby version (3.3.0). Note that I'm in a directory where my current working Ruby version is 3.3.4 using asdf
.
Not really sure what's causing that, but the ruby-lsp
logs show that the server is working using version 0.17.9 (even though Mason is still "failing to install" under a different Ruby version and showing the package as out of date) now that I manually ran gem install ruby-lsp
in the project directory:
. . .
"/Users/me/.asdf/shims/ruby-lsp" "stderr" "Initializing Ruby LSP v0.17.9...\n"
[ERROR][2024-07-23 22:34:27] .../vim/lsp/rpc.lua:770 "rpc" "/Users/me/.asdf/shims/ruby-lsp" "stderr" "Finished initializing Ruby LSP!\n"
[ERROR][2024-07-23 22:34:27] .../vim/lsp/rpc.lua:770 "rpc" "/Users/me/.asdf/shims/ruby-lsp" "stderr" "[Standard Ruby] Activating Standard
. . .
EDIT: @cmoel's actually did work for me (I thought I'd already tried that... guess not). Thank you!
I take it back, that didn't work. Still having issues. I've uninstalled the packages and tried to reinstall with Mason but it still looks like:
rubocop
~ ▼ Displaying full log
~ Installing gem rubocop@1.65.1…
~ Successfully installed unicode-display_width-2.5.0
~ Successfully installed ruby-progressbar-1.13.0
~ Building native extensions. This could take a while...
~ ERROR: Error installing rubocop:
~ rubocop-ast requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.
~ Successfully installed racc-1.8.1
~ Successfully installed ast-2.4.2
~ Successfully installed parser-3.3.4.0
~ spawn: gem failed with exit code 1 and signal 0.
standardrb
~ ▼ Displaying full log
~ Installing gem standard@1.39.2…
~ Successfully installed language_server-protocol-3.17.0.3
~ Building native extensions. This could take a while...
~ ERROR: Error installing standard:
~ rubocop-ast requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.
~ Successfully installed racc-1.8.1
~ Successfully installed ast-2.4.2
~ Successfully installed parser-3.3.4.0
~ spawn: gem failed with exit code 1 and signal 0.
ruby-lsp
~ ▼ Displaying full log
~ Installing gem ruby-lsp@0.17.11…
~ ERROR: Error installing ruby-lsp:
~ sorbet-runtime requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.
~ spawn: gem failed with exit code 1 and signal 0.
My ruby version, globally, is 3.3.4
, this (I assume) is referring to the default 2.6 Ruby version installed by MacOS that's always there.
I tend to use homebrew for my neovim dependencies and, if you're like me, you may not have noticed that brew install ruby
doesn't add the updated ruby interpreter to your system PATH.
brew info ruby
:``` ... ==> Caveats By default, binaries installed by gem will be placed into: /opt/homebrew/lib/ruby/gems/3.3.0/bin You may want to add this to your PATH. ruby is keg-only, which means it was not symlinked into /opt/homebrew, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble. If you need to have ruby first in your PATH, run: echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc For compilers to find ruby you may need to set: export LDFLAGS="-L/opt/homebrew/opt/ruby/lib" export CPPFLAGS="-I/opt/homebrew/opt/ruby/include" ... ```
My Homebrew path is /opt/homebrew
, but yours might be /usr/local/homebrew
or similar. Adjust accordingly below.
Lua:
vim.fn.setenv('PATH', vim.fn.expand('/opt/homebrew/opt/ruby/bin:$PATH'))
Vimscript:
setenv('PATH', expand('/opt/homebrew/opt/ruby/bin:$PATH'))
I've searched open issues for similar requests
I've recently downloaded the latest plugin version of mason.nvim
Problem description
I'm trying to install solargraph via Mason (
:MasonInstall solargraph
) and it's failing when attempting to build native extensions with the following error:Running
:checkhealth
I can see the following info about NeoVim, Mason, and the running Ruby version:Expected behavior
Based on my
:checkhealth
output, I would expect Mason to use my active version of Ruby to attempt the install, but it seems to be using a completely different one.Affected packages
solargraph
Mason output
Screenshots
No response