This question already has an answer here:
-
Can I delete some folders of nokogiri and capybara-webkit inside of my rvm gemset?
2 answers
I have to use nokogiri for some xml processing.
For this I create a rvm gemset specific to the project and install nokogiri by gem install nokogiri. No problems this far.
But when I look into ~.rvm/gems/ruby-...@nokogiri/gems/nokogiri-.../ext/nokogiri/ and its subfolders I see files worth of 140MB in the filesystem.
Is there some generic way of removing this cruft?
That's slightly larger than what I get. I see 108MB on OS X, with the major offenders being 88MB in ext
, 18MB in ports
, 750k in test
and 520k in lib
.
In ext/nokogiri
you certainly don't need the 87MB of tmp
directory. So that's a major savings right there.
phrogz$ pwd
/Users/phrogz/.rvm/gems/ruby-1.9.3-p392/gems/nokogiri-1.6.1
phrogz$ du -sh .
108M .
phrogz$ rm -rf ext/tmp
phrogz$ du -sh .
21M .
Then again, you also don't need any of the source, header, or compiled files in there, either:
phrogz$ cd ext/nokogiri/
phrogz$ rm *.c *.h *.o
phrogz$ cd ../../
phrogz$ du -sh .
20M .
I'm pretty sure you don't need the ports/archives
directory, which contains the .tar.gz
source of libxml2 and libxslt:
phrogz$ rm -rf ports/archives/
phrogz$ du -sh .
12M .
And then there's a few megs of documentation for the libraries you can remove for sure:
phrogz$ rm -rf ports/x86_64-apple-darwin13.1.0/libxml2/2.8.0/share/doc/
phrogz$ rm -rf ports/x86_64-apple-darwin13.1.0/libxml2/2.8.0/share/gtk-doc/
phrogz$ rm -rf ports/x86_64-apple-darwin13.1.0/libxslt/1.1.26/share/doc/
phrogz$ du -sh .
4.4M .
You could probably pare it down further, removing things like the test
directory. But now you've made a huge dent in the problem.