Bill Martin Bill Martin - 2 years ago 257
Ruby Question

Why am I Getting "Error Copying Gems" in Rubymine while setting "Ruby SDK and Gems" to use Vagrant

I'm trying to configure Rubymine 6.3.3 to use the Ruby SDK and gems from my vagrant virtual machine.

Rubymine (at least, 6.3.3) has built-in support for this. To set it up, I do the following:

  1. Click on "File" -> "Settings"

  2. Click the "Ruby SDK and Gems" section

  3. Add a new remote by clicking the "+" add option -> "New Remote"

  4. Click the "Fill from Vagrant Config" button in the "Configure Remote Ruby Interpreter" dialog, which defaults to the following settings (I override the default keypair settings to instead use a password):

    • Host:

    • Port: 2222

    • User name: vagrant

    • Auth type: password

    • Password: vagrant

    • Ruby interpreter path: /usr/bin/ruby (verified with
      $ which ruby
      on guest OS)

  5. Test the connection, by clicking the "Test connection" button, which is successful

  6. Click "OK" to finish

When downloading gems, it recursively goes deeper and deeper into the /usr/bin/X11/ directory like:

  • /usr/bin/X11/gtk-launch

  • /usr/bin/X11/X11/gtk-launch

  • /usr/bin/X11/X11/X11/gtk-launch

  • /usr/bin/X11/X11/X11/X11/gtk-launch

After getting stuck in that loop for a while, it gets stuck in a loop of downloading various gems, and creating a folder (which I cannot see what folder because it flashes too quickly).

It eventually ends with an "Error Copying Gems" dialogue stating:

Could not copy "sftp://" to "file:///home/billy/.RubyMine60/system/ruby_stubs/-828640210/170586877/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/X11/x86_64-linux-gnu-gcc-nm".

Upon clicking OK, it gets stuck in another loop of attempts at downloading the gems, and after clicking OK for a second time to the same error message, it exits, and just shows my new "Ruby SDK and Gems" configuration with no gems.

The virtual machine has the following versions installed:

vagrant@rails-dev-box:/vagrant $ ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux-gnu]
vagrant@rails-dev-box:/vagrant/ $ bundle -v
Bundler version 1.11.2
vagrant@rails-dev-box:/vagrant/ $ gem environment
RubyGems Environment:
- RUBY VERSION: 2.2.4 (2015-12-16 patchlevel 230) [x86_64-linux-gnu]
- INSTALLATION DIRECTORY: /var/lib/gems/2.2.0
- RUBY EXECUTABLE: /usr/bin/ruby2.2
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /home/vagrant/.gem/specs
- ruby
- x86_64-linux
- /var/lib/gems/2.2.0
- /home/vagrant/.gem/ruby/2.2.0
- /usr/share/rubygems-integration/2.2.0
- /usr/share/rubygems-integration/all
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games

Why can Rubymine not configure these gems properly?

Answer Source

The problem is the symbolic link from /usr/bin/X11 => /usr/bin/ that Ubuntu has. This sent RubyMine down a recursive /usr/bin/X11/X11/X11/" path trying to find gems, finally resulting in the error.

Since the OS is only being used as a virtual machine through Vagrant, I deleted the /usr/bin/X11 symbolic link. This allowed RubyMine to find the gems and everything worked as expected.

Considering there is a valid reason for the existence of this symbolic link, this may just be a hack-fix for a peculiar RubyMine bug.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download