Cannot add Ruby SDK which is installed via asdf on MacOS

I get the follow error...

"Error configuring SDK: Could not get RubyGems environment for ruby-2.7.3"

I'm using the path that RubyMine finds automatically which matches "which ruby"

Anyone know how to get this setup?

1
4 comments

Hello Andy,

Could you please add debug logger identifier for asdf as it's described here: https://www.jetbrains.com/help/ruby/ruby-version-managers.html#how_debug_detection

Restart IDE and attach idea.log (if you want you can attach it to the issue on the tracker https://youtrack.jetbrains.com/issues/RUBY or send to rubymine-support@jetbrains.com)

0

I'm having the same issue with Ruby 2.6.6 and ASDF. I'm on Apple Silicon and MacOS 12.0.1, if that matters. ASDF is installed in ~/.local. Here's what I see when I grep my log file for 'asdf' after starting RubyMine:

2021-11-11 06:06:03,494 [ 3708] INFO - lij.diagnostic.DebugLogManager - Set DEBUG for the following categories: #org.jetbrains.plugins.ruby.version.management.asdf.AsdfSdkRefresher
2021-11-11 06:06:03,740 [ 3954] INFO - lij.diagnostic.DebugLogManager - Set DEBUG for the following categories: #org.jetbrains.plugins.ruby.version.management.asdf.AsdfSdkRefresher
2021-11-11 06:06:03,820 [ 4034] INFO - penapi.application.Experiments - Experimental features enabled for user: wsl.p9.support, wsl.prefer.p9.support, wsl.p9.show.roots.in.file.chooser, wsl.execute.with.wsl.exe, linux.native.menu, recent.and.edited.files.together, show.create.new.element.in.popup, search.everywhere.mixed.results, editor.reader.mode, new.large.text.file.viewer, wsl.fsd.content.loader, terminal.shell.command.handling, reuse.target.paths.for.rsync, auto.indent.chain.call.on.first.char, ruby.force.explicit.bundle.exec, ruby.asdf.use.shell, ruby.run.anything.remote.sdk.enabled, ruby.use.experimental.debugger
2021-11-11 06:06:08,066 [ 8280] DEBUG - nagement.asdf.AsdfSdkRefresher - Got real path: /opt/homebrew/opt/asdf/libexec/bin/asdf -> /opt/homebrew/Cellar/asdf/0.8.1_1/libexec/bin/asdf
2021-11-11 06:06:08,370 [ 8584] DEBUG - nagement.asdf.AsdfSdkRefresher - Refreshing sdks
2021-11-11 06:06:08,371 [ 8585] DEBUG - nagement.asdf.AsdfSdkRefresher - Got real path: /opt/homebrew/opt/asdf/libexec/bin/asdf -> /opt/homebrew/Cellar/asdf/0.8.1_1/libexec/bin/asdf
2021-11-11 06:06:08,371 [ 8585] DEBUG - nagement.asdf.AsdfSdkRefresher - Found version manager in /opt/homebrew/Cellar/asdf/0.8.1_1/libexec/bin/asdf
2021-11-11 06:06:08,372 [ 8586] DEBUG - nagement.asdf.AsdfSdkRefresher - Got real path: /opt/homebrew/opt/asdf/libexec/bin/asdf -> /opt/homebrew/Cellar/asdf/0.8.1_1/libexec/bin/asdf
2021-11-11 06:06:08,372 [ 8586] DEBUG - nagement.asdf.AsdfSdkRefresher - Got 0 sdk infos
2021-11-11 06:06:08,372 [ 8586] DEBUG - nagement.asdf.AsdfSdkRefresher - Got 1 ruby sdks
2021-11-11 06:06:08,372 [ 8586] DEBUG - nagement.asdf.AsdfSdkRefresher - Got 0 sks managed by me
2021-11-11 06:06:08,373 [ 8587] DEBUG - nagement.asdf.AsdfSdkRefresher - 0 sdks should be created
2021-11-11 06:06:08,373 [ 8587] DEBUG - nagement.asdf.AsdfSdkRefresher - 0 sdks should be removed

 

if I try to add ~/.local/share/asdf/shims/ruby as a ruby version under Preferences > Ruby SDK and Gems, this appears in the logs:

2021-11-11 06:11:57,514 [ 357728] WARN - plugins.ruby.gem.gem.GemRunner - Error getting raw environment for ruby-2.6.6-p146: ver.2.6.6p0 (/Users/ryan/.local/share/asdf/shims/ruby): /Users/ryan/.local/share/asdf/installs/ruby/2.6.6/bin/ruby: no Ruby script found in input (LoadError)
2021-11-11 06:11:57,517 [ 357731] WARN - oots.impl.SdkConfigurationUtil - Error creating or configuring sdk: homeDir=[file:///Users/ryan/.local/share/asdf/shims/ruby]; sdkType=[RUBY_SDK]; additionalData=[null]; customSdkSuggestedName=[null]; sdk=[ruby-2.6.6-p146: ver.2.6.6p0 (/Users/ryan/.local/share/asdf/shims/ruby)]
java.lang.RuntimeException: Could not get RubyGems environment for ruby-2.6.6-p146: ver.2.6.6p0 (/Users/ryan/.local/share/asdf/shims/ruby)
Caused by: org.jetbrains.plugins.ruby.ruby.sdk.RubySdkConfigurationException: Could not get RubyGems environment for ruby-2.6.6-p146: ver.2.6.6p0 (/Users/ryan/.local/share/asdf/shims/ruby)
0

As a workaround, I was able to directly add the ruby executable in ~/.local/share/asdf/installs/ruby/2.6.6/bin/ruby

0

Ryan, could you please add another 2 lines to Help - Diagnostic Tools - Debug Log Settings:

#org.jetbrains.plugins.ruby.ruby.run.RubyCommandLine
#com.intellij.execution.configurations.GeneralCommandLine

restart IDE, wait while indexing is finished and attach the fresh idea.log. You can submit a separate issue for that on our tracker: 

https://youtrack.jetbrains.com/issues/RUBY

0

Please sign in to leave a comment.