#!/usr/bin/env ruby gem_list = `gem list --no-version` gem_list.each_line do |line| next if line.empty? || /LOCAL GEMS/ =~ line system "gem uninstall -axI #{line}" end Register as a new user and use Qiita more conveniently You get articles that match your needsYou can efficiently read back useful informationYou can use dark themeWhat you can do with signing up