3
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
.
3
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
.
4
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
refers to the bin
ary dir
ectory. 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.
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.
Thanks for taking the time to clarify that for me. Will using
– jsejcksn – 2016-07-21T16:09:03.503--user-install
for a gem (like Jekyll for instance) affect anything about operation, future updates, etc.? Or was Ruby written to operate the same way whether gems are inGEM_HOME
or elsewhere?@jsejcksn Changing the default file path with
--user-install
will not negatively affect anything about operation. Whatever that new path is would be just added to your~/.gemrc
file so your local Ruby install would be able to keep track of it like anything else and do whatever it has to do to keep things running. – JakeGould – 2016-07-21T16:12:04.723I don't have a
~/.gemrc
file, even after installation. Were you implying that the installation would create it or is that another step I need to take manually? – jsejcksn – 2016-07-21T16:48:31.143@jsejcksn My bad on the
~/.gemrc
; I mixed up concepts and now realize that the locally installed Ruby GEMs will be installed in the~/.gem
path which is—of course—in your user’s home directory. Updated my answer to clear this up. – JakeGould – 2016-07-21T23:50:47.917