Lost Bundler on upgrade to El Capitan - how to reinstall Bundler in a safe way for Boxen?
henscu opened this issue · 8 comments
I just tried to get my Boxen up to date as per the upgrade instructions. I haven't upgraded since Jan 2015. However the process fails when I get to the bundle install...
command below:
rm Puppetfile.lock Gemfile.lock
bundle install --no-deployment --without development --path .bundle
rbenv: bundle: command not found
The `bundle' command exists in these Ruby versions:
2.1.0
Somehow I lost Bundler from /usr/bin! I looked for a solution online that would be compatible with Boxen.
Some people suggest simply doing a gem install bundler
from my home directory. However I saw some warnings about this approach.
What is the best way to reinstall Bundler (or any /usr/bin application) in a way that is compatible with Boxen?
+1
For lack of better idea, our team (all of us have run into this on the El Capitan update) have been taking the gem install bundler
route. Haven't noticed any odd side effects, at least yet, with boxen
. But, like you, we have some lingering concerns that this isn't the best way.
Looks like other folks are running into this...good to know we're not alone, I suppose!
Within our private fork, we have made a couple of adjustments which address this in El Capitan.
- Updating system bundler
diff --git a/script/bootstrap b/script/bootstrap
index a0d4026..7282a29 100755
--- a/script/bootstrap
+++ b/script/bootstrap
@@ -54,10 +54,10 @@ set -e
# FIX: only sudo if gem home isn't writable
-(/usr/bin/gem spec bundler -v '~> 1.5.3' >/dev/null 2>&1) || {
+(/usr/bin/gem spec bundler -v '~> 1.10.5' >/dev/null 2>&1) || {
log "====> Installing bundler to system ruby"
/usr/bin/sudo -p "Password for sudo to install bundler: " \
- /usr/bin/gem install bundler -v '~> 1.5.3' --no-rdoc --no-ri
+ /usr/bin/gem install bundler -v '~> 1.10.5' --no-rdoc --no-ri
}
PATH="/Library/Ruby/bin:$PATH"
- Adding system bundler to the
$PATH
diff --git a/script/bootstrap b/script/bootstrap
index f233066..3b611e5 100755
--- a/script/bootstrap
+++ b/script/bootstrap
@@ -59,7 +59,7 @@ set -e
/usr/bin/sudo -p "Password for sudo to install bundler: " \
/usr/bin/gem install bundler -v '1.10.5' --no-rdoc --no-ri
}
-PATH="/Library/Ruby/bin:$PATH"
+PATH="/Library/Ruby/bin:$(gem which bundler | sed -e 's!lib/bundler.rb!bin!'):$PATH"
# Use checksums to quickly determine if we need to re-bundle
We are looking at pushing these upstream after getting some more testing around the changes but feel free to apply it and let me know how it works out for you.
@jacobbednarz's patch worked wonders for me. Thank you!
@jacobbednarz , what's the easiest way to test your fix? Is it:
- Create a branch
- Edit script/bootstrap as above
- Re-run Boxen to fix path to bundler
- Rerun Boxen upgrade, in which the bundler command should now work.
Or do I need to nuke Boxen, then re-run it?
@jacobbednarz patch worked for me..!
My apologies @henscu - I was on vacation when your question came through and only just noticed this pop up again in my feed. The usual way I run the testing is just to checkout the remote branch from the Boxen directory and then run boxen
. However, this one was slightly different so I nuked Boxen and started fresh (as that was where the problem existed).
Thanks @jacobbednarz . Can I close this issue now or should I wait until #804 is merged?