So this just took me 3 days, since nothing else I was finding here was helping. I also run multiple projects through RubyMine at the same time (and different versions) so setting my GEM_PATH and launching from command-line doesn't work for me. I use IntelliJ with RM plugin, this should work on RM standalone.
Bundler seems to install custom gems, or gems from custom repos, in a different directory than gems from rubygems, or github.
/Users/YOURUSER/.rvm/environments/ruby-{version}\@yourgemset/bundler/gems
One thing I wasn't able to fix is in the GEMFILE, I have some custom git_sources, and rubymine highlights those and gives me the warning that it cannot find the gem in my bundle (you can ignore this warning; unless the gem doesn't install at all):
gem 'somegem', custom_git:'gituser/repo'
is highlighted and warning is "Gem x cannot be found... in SDK'
However Bundler installed it, and ruby is able to load it.
# TLDR: Steps to have RUBYMine find extra gems, and show up in external libs
- vim ~/.rvm/environments/ruby-{your-verion-here}\@{your-gemset}
- add the bundler gems path to GEM_PATH entry
export GEM_PATH='/Users/YOURUSER/.rvm/gems/ruby-{version}@yourgemset/bundler/gems:{the rest}'
- save the file
- Restart RubyMine/IntelliJ, reopen your project (if not open automatically)
- Open the
Project Structure
dialog > Platform SDKs
> Choose the GEMSET you're working with
- add
/Users/YOURUSER/.rvm/environments/ruby-{version}\@yourgemset/bundler/gems
to your classpath
- Hit OK, then REOPEN the
Project Structure
Dialog > Project Settings
> Project
- Your project will likely have no SDK So select the one you're using again and hit OKAY
- RM/IJ will now reindex files
- You're done, any broken/missing inspection links should now be fixed. And you should be able to introspect into your gems.
In the above instructions that when you run bundle install (from terminal or RM) it works successfully, and that you have RVM correctly setup, and gemset already created
I hope this helps! Let me know if I should clarify anything (happy NYE)