38

I want to install a ruby gem globally (sudo gem install capybara-webkit) but I want it to be installed from the master in its github repository. I know this can be done using bundler but I want to do it from the command line because I'm coding mainly using pry.

Nakilon
  • 34,866
  • 14
  • 107
  • 142
GTDev
  • 5,488
  • 9
  • 49
  • 84

1 Answers1

73
  1. Download the source:

    git clone https://github.com/thoughtbot/capybara-webkit.git
    
  2. Build the gem:

    cd capybara-webkit && gem build capybara-webkit.gemspec
    
  3. Install it (the filename/version may vary):

    sudo gem install capybara-webkit-0.14.1.gem
    
Wally Altman
  • 3,535
  • 3
  • 25
  • 33
  • 4
    I would leave the `sudo` off of step 3, (https://stackoverflow.com/questions/2119064/sudo-gem-install-or-gem-install-and-gem-locations) but otherwise, great answer! The one other thing to note is that the `.gemspec` file isn't always exactly the same as the name of the gem or the directory it's in, so just double check the filename before step 2. – Scott Schupbach Jul 24 '17 at 16:54
  • I'm not sure of the effect of `sudo` by on Cygwin I used `gem install --no-user-install`, otherwise it installs into `~/.gem/ruby/$VER`. `--no-user-install` is a saver. – gavenkoa Jun 02 '21 at 22:02