How do you remove the documentation installed by gem install?

Viewed 10144

I know it's possible to install a gem without the documentation, but unfortunately, I didn't for the first three months I used ruby. In that time, I managed to install a significant amount of gems, but not once since I started using ruby have I used the documentation on my computer. I always look to docs on the internet.

What is the best way to safely remove the documentation from my computer? Also, is there a way to configure ruby to not install documentation by default?

6 Answers

This command worked for me in removing documentation installed by install.

rm -r "$(gem env gemdir)"/doc/*

Here's another way to go about it;

To locate the folder where gems are installed on your system, simply run the following on terminal or shell

gem env home

This will display an output like

/home/username/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0

You can then locate the docs folder and delete all the documentations that you find there for each gem in a ruby version

I also want to add this too to the answers provided,

if want to prevent gems from generating documentation during installation, then turn off local documentation generation by creating a file called ~/.gemrc which contains a configuration setting to turn off this feature:

Simply run this code in your terminal or shell

printf "install: --no-rdoc --no-ri\nupdate:  --no-rdoc --no-ri\n" >> ~/.gemrc

OR

echo "gem: --no-document" > ~/.gemrc

This will prevent gems from generating documentation during installation, saving you the stress of deleting/removing gem documentations on your system later.

That's all

I hope this helps.

Related