Skip to main content Link Search Menu Expand Document (external link)

Gem Cleanup

The OpenHAB JRuby add-on will automatically download and install the latest version of the library according to the settings in jruby.cfg. Over time, the older versions of the library will accumulate in the gem_home directory. The following code saved as gem_cleanup.rb or another name of your choice can be placed in the jsr223/ruby/personal/ directory to perform uninstallation of the older gem versions.

require 'rubygems/commands/uninstall_command'

cmd =

# uninstall all the older versions of the openhab-scripting gems
                  .select { |gem| == 'openhab-scripting' }
                  .tap(&:pop) # don't include the latest version
                  .each do |gem|
  cmd.handle_options ['-x', '-I',, '--version', gem.version.to_s]