Creates a “bundle” file of all installed gems with executables for easy restore on a new system.
Creates a “bundle” file of all installed gems with executables. The resulting file is an executable script that can be run standalone, or in combination with this script to add options like sudo or --user-install to the gem install commands. These options can be specified when creating the file as well. A file created with sudo or --user-install commands can still be overridden when running via this script and --install.
Created file is called Binfile in the current directory unless another path is specified with --file.
Installation
Install with:
$ gem install binbundle
If this causes errors, use:
$ gem install --user-install binbundle
Usage
Run binbundle bundle to create a Binfile in the current directory, or with --file FILENAME to specify a path/filename. That file can optionally be made executable (you’ll be prompted). In the future when doing a clean install or using a new system, you can just run that file as a standalone to reinstall all of your gem binaries.
Example:
binbundle bundle --file ~/dotfiles/Binfile
Using this script with the install subcommand will read the Binfile and execute it line by line, adding options like version numbers, sudo, or the --user-install flag, overriding any of these specified when bundling.
You can also run with subcommands bundle or install, e.g. bundle_gem_bins install.
Options
Usage: binbundle [options] [bundle|install]
--[no-]versions Include version info in output (default true)
--dry-run Output to STDOUT instead of file
-s, --sudo Install gems with sudo
-u, --user-install Use --user-install to install gems
-f, --file FILE Output to alternative filename (default Binfile)
-l, --local Use installed gems instead of Binfile for gem_for and bins_for
-v, --version Display version
-h, --help Display this screen
Info commands
You can retrieve some basic info about gems and their binaries using binbundle gem for BIN or binbundle bins for GEM. This will read Binfile or any file specified by --file and return the requested info, either the gem associated with the given binary (BIN), or the binaries associated with the given gem name (GEM).
Use either info command with --local to parse installed gems rather than a Binfile.
Recommendations
I recommend using Binbundle along with a tool like Dotbot. Commit your bundle to a repo that you can easily clone to a new machine and then make gem install binbundle and binbundle install ~/dotfiles/Binfile part of your restore process.
Changelog
Click to expand
1.0.10
2024-08-04 13:00
IMPROVED
When installing, test if the gem/version is already installed and skip
When installing, verify that the specified gem exists on the host before running the install command. Adds a pause before execution, but saves a lot of time looking up missing gems.
1.0.9
2024-08-02 10:42
NEW
binbundle gem for BIN will show what gem is responsible for a binary
binbundle bins for GEM will show what binaries a gem installs