Make homebrew remove old versions of portable-ruby


(Resistor4u) #1

Referring to the issue posted here: https://github.com/Homebrew/homebrew-portable-ruby/issues/62

It’s not clear to me there’s a way for brew to check for previous versions of portable-ruby and then remove any it finds. I found two old versions lingering around at /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/ totaling about 67 MB. The space saved by tossing older versions could help out users on small, internal SSDs.

Is there any other real reason to keep the older versions hanging around?


(Mike McQuaid) #2

Good idea! I’ve opened an issue to solicit pull requests on this: https://github.com/Homebrew/brew/issues/4256


(Resistor4u) #3

Hey @MikeMcQuaid, are the multiple versions of rubocop, parser, and ast also OK to ax? My installation has:

/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/ast-2.3.0
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/ast-2.4.0
...
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.0
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/parser-2.5.0.2
...
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.51.0
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.52.1

(Mike McQuaid) #4

Yes but I believe bundle cleanup will do that for you (and calling it if vendor/bundle exists would be probably an easy, separate PR and a better idea than doing it manually).


(Resistor4u) #5

Hombrew’s ruby formula installs bundle, but homebrew’s portable-ruby installation does not have bundle installed. Doing

/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3_2/bin/gem install bundle

put it into /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3_2/lib/ruby/gems/2.3.0/gems. Calling it did not touch the older extra versions in /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems, etc. Then, running /usr/local/Homebrew/Library/Homebrew/bin/bundle clean gave me this output

Activating bundler (< 2) failed:
Could not find 'bundler' (< 2) among 4 total gem(s)

To install the version of bundler this project requires, run `gem install bundler -v '< 2'`

And, running /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3_2/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/exe/bundle clean gave me this

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler (LoadError)
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3_2/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/exe/bundle:10:in `<main>'

My difficulty is because I’m still a ruby novice, and not being able to offer substantive help is holding me back from submitting a new PR. (Looking the scripts of bundler, etc., I suspect there’s confusion because it calls Mac’s system ruby.)

I think my best bet for now is to brew bundle dump and then completely redo the homebrew installation. It might seem extreme, but I’ve been hacking away at different stuff under the hood for years, and it feels like a good opportunity for a fresh start. It does not, however, solve the problems above, unless @MikeMcQuaid, you have a different suggestion.