asdf-ruby: IntelliJ won't detect Ruby interpreter installed using asdf-vm whatsoever

IDE and OS version

IDE - IntelliJ IDEA 2022.1.1 (Ultimate Edition): Build #IU-221.5591.52, built on May 11, 2022 OS - Pop!_OS 22.04 LTS

What steps will reproduce the issue?

Install the latest version of Ruby using asdf-vm Create a new Ruby project in IntelliJ

What is the expected result? Intellij should detect the Ruby interpreter installed using asdf-vm

What happens instead? IntelliJ detects Ruby interpreter from the location /usr/bin/ruby instead. No Ruby interpreter was installed at this location. Upon manually navigating to that directory, no Ruby interpreter is found. Also unable to delete this file using IntelliJ. When trying to manually change the interpreter to asdf-vm location (/home/jaymin/.asdf/shims/ruby), it throws the following error:

Error configuring SDK: Unable to read RbConfig for ruby (/home/jaymin/.asdf/shims/ruby). Please make sure that /home/jaymin/.asdf/shims/ruby is a valid home path for this SDK type.

Log file The log file is attached herewith idea.log

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (1 by maintainers)

Most upvoted comments

For future reference, I experienced the same issue today with asdf 0.15.0:

  • I followed the debugging steps suggested by Jetbrains here.
  • In the logs, I could clearly see errors on the line of this one for all asdf-installed ruby versions:
    2025-01-02 13:14:56,759 [  14961]   WARN - #c.i.o.p.i.SdkConfigurationUtil - Error creating or configuring sdk: homeDir=[file:///Users/jacegu/.asdf/installs/ruby/3.2.4/bin/ruby]; sdkType=[RUBY_SDK]; additionalData=[RubySdkAdditionalData{myInitializedPaths=true, myTemporaryRoots=null, myGemsBinDirectory='null', myGemsRootsUrls=null, myLanguageLevel=null, myPlatform='null', myVersionManagerSdkAdditionalData=org.jetbrains.plugins.ruby.version.management.asdf.AsdfSdkData@14201f8, myRbConfig=org.jetbrains.plugins.ruby.ruby.sdk.RbConfig@56b78376, myNormalizedVersionString='null', myIsWritable=false}]; customSdkSuggestedName=[asdf: 3.2.4]; sdk=[null]
    java.lang.RuntimeException: Could not get RubyGems environment for asdf: 3.2.4 Version:null Path:(/Users/jacegu/.asdf/installs/ruby/3.2.4/bin/ruby)
    
  • I could also identify an error similar to the one described here:
    2025-01-02 13:14:56,759 [  14961]   WARN - #o.j.p.r.g.g.GemRunner - Error getting raw environment for asdf: 3.2.4 Version:null Path:(/Users/jacegu/.asdf/installs/ruby/3.2.4/bin/ruby): bash: line 1: /opt/homebrew/Cellar/asdf/0.15.0/asdf.sh: No such file or directory
    
  • Running asdf reshim did not help with this issue for some reason.
  • I recreated the symlink:
    ln -s /opt/homebrew/Cellar/asdf/0.15.0/libexec/asdf.sh /opt/homebrew/Cellar/asdf/0.15.0/asdf.sh
    
  • It solved the problem for me.

For future readers, asdf reshim fixed it in v0.13.1-0586b37

If you’re having problems with RubyMine since updating asdf to v0.16+: https://youtrack.jetbrains.com/issue/RUBY-33864/Support-asdf-0.16

I followed How to: Debug detecting of Ruby interpreters and added #org.jetbrains.plugins.ruby.version.management.asdf.AsdfSdkRefresher in Custom Debug Log Configuration dialog.

Checking logs revealed this error:

zsh: no such file or directory: /usr/local/Cellar/asdf/0.11.0/asdf.sh

Which is correct. The correct path, at least in asdf 0.11.0 is

/usr/local/Cellar/asdf/0.11.0/libexec/asdf.sh

Creating the link and restarting IDE fixed the issue for me

ln -s /usr/local/Cellar/asdf/0.11.0/libexec/asdf.sh /usr/local/Cellar/asdf/0.11.0/asdf.sh

Update: I installed RubyMine and Intellij using JetBrains Toolbox and it seems to fix the issue. Earlier, both these IDEs were installed using Pop!_Shop. Ruby versions are being detected automatically.

This is really looks like a question to rubymine tracker. But anyway, if RM or ruby plugin unable to detect asdf by itself (usually this happens if it’s installed in unusual place), you should add it manually, but specify path to asdf binary, not ruby. However, it’s really strange, seems you have a pretty default path. Please, fill an issue in https://youtrack.jetbrains.com/issues/RUBY

I tried using the directory mentioned in the question as well as /home/jaymin/.asdf/installs/ruby/3.1.2/bin/ruby directory, but I get the same error. Is there any other directory I should be trying?

Issue on YouTrack - https://youtrack.jetbrains.com/issue/RUBY-29810/IntelliJ-wont-detect-Ruby-interpreter-installed-using-asdf-vm-whatsoever