4

I don't have a desire at the moment to learn Ruby, but I just want to know what the difference is between gem install --bindir ~/path/ and gem install --user-install as long as each of the paths are in my $PATH.

Giacomo1968
  • 58,727
jsejcksn
  • 4,581

1 Answers1

6

Look at the Ruby GEM command reference here:

-n, -​-bindir DIR - Directory where binary files are located

-​-[no-]user-install - Install in user’s home directory instead of GEM_HOME.

Effectively, and operationally you—as an end user using Ruby—would not really notice a difference if the file paths are in your $PATH. But each command clearly deals with a different filesystem aspect of a Ruby GEM install.

-​-bindir

-​-bindir refers to the binary directory. Many Ruby GEMS install Ruby script files as part of their core library function but also install a “binary” as part of their install process. Meaning, if you are a Ruby programmer you might want to install a Ruby GEM so you can have a usable reference to it’s core code within your own custom code. But a binary file that performs an equivalent or “helper” task is installed along side those Ruby GEM library files. From a filesystem management point of view, some users might want to install those binary files in a separate directory instead of the default Ruby GEMs directory.

-​-user-install

So while -​-bindir is an option to control where binary files associated with Ruby GEMs get installed, -​-user-install is a manual override for where all Ruby GEM files get installed; binaries, libraries and other stuff like that. By using -​-user-install you are instructing Ruby GEM to install GEMs in the ~/.gem directory which is—of course—in your user’s home directory. Without the -​-user-install option, the Ruby GEM files would be installed to wherever the default GEM_HOME path is.

Changing the default file path with --user-install will not negatively affect anything about operation. The Ruby GEMs would just be installed in a ~/.gem directory—which is in your home directory—and Ruby will know to check there as well as it’s own default path for updates.

Giacomo1968
  • 58,727