Ruby (rvm), vim, and mojave error (incompatible library…)

While setting up my vimrc for ruby development I ran into the following error:

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:17:in `require': incompatible library version - /System/Library/Frameworks/Ruby.frame
work/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin18/stringio.bundle (LoadError)
        from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:17:in `<top (required)>'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:1230:in `require'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:1230:in `<module:Gem>'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:116:in `<top (required)>'
        from <internal:gem_prelude>:4:in `require'
        from <internal:gem_prelude>:4:in `<internal:gem_prelude>'

This is apparently an issue with mojave and appears to be related to using the system’s ruby vs the rvm.

By adding the following to my vimrc I was able to cease the error:

let $RUBYHOME=$HOME."/.rvm/rubies/default"
set rubydll=$HOME/.rvm/rubies/default/lib/libruby.dylib