Remove gems

Delete custom gems installed at the user level - only your user could run them.

$ rm -rf ~/.gem

Delete system-wide custom gems - any user could run them. If only root has access to modify this directory, then you’ll need to run with sudo.

$ rm -rf /usr/local/lib/ruby/

That directory contains gems/ and site_ruby by the way.

Remove Ruby

Remove the custom Ruby using your package manager.

macOS

$ brew uninstall ruby

Linux

$ sudo apt remove ruby ruby-dev

Or, if you installed as ruby-full, then run:

$ sudo apt remove ruby-full