title: Running Ruby gems with Cygwin
body: <p>I am using Cygwin with the cygwin'd version of ruby on Windows.</p>
  
  <pre><code>$ ruby -v
  ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-cygwin]
  </code></pre>
  
  <p>After successfully installing rspec (gem install rspec), I try running the basic init command (rspec --init) to get started, but I get a bash command not found message.</p>
  
  <pre><code>$ rspec --init
  -bash: rspec: command not found
  </code></pre>
  
  <p>I'm guessing this is happening because there is no "rspec" file under my C:\cygwin64\bin directory (as there is "ruby","irb", etc. files that cygwin must look at when commands are typed into it).</p>
  
  <p>Looking through my cygwin directories, I can see the rspec "exe" file under "C:\cygwin64\home\username\.gem\ruby\gems\rspec-core-3.3.2\exe". I think this means it is simply a matter of adding this file to cygwin's path, but I have not been able to find a good example of this. Ideally the solution would handle this gem (rspec) and all future installs without having to "hard-code" the path everytime.</p>
  
  <p>Looking at my "gem environment", it seems like the installed gems are already under my "GEM PATHS". It seems like there's a disconnect between this and where Cygwin is looking.</p>
  
  <pre><code>$ gem environment
  RubyGems Environment:
    - RUBYGEMS VERSION: 2.4.7
    - RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-cygwin]
    - INSTALLATION DIRECTORY: /home/username/.gem/ruby
    - RUBY EXECUTABLE: /usr/bin/ruby.exe
    - EXECUTABLE DIRECTORY: /home/username/bin
    - SPEC CACHE DIRECTORY: /home/username/.gem/specs
    - SYSTEM CONFIGURATION DIRECTORY: /etc
    - RUBYGEMS PLATFORMS:
      - ruby
      - x86_64-cygwin
    - GEM PATHS:
       - /home/username/.gem/ruby
       - /usr/share/gems
       - /usr/local/share/gems
    - GEM CONFIGURATION:
       - :update_sources =&gt; true
       - :verbose =&gt; true
       - :backtrace =&gt; false
       - :bulk_threshold =&gt; 1000
    - REMOTE SOURCES:
       - https://rubygems.org/
    - SHELL PATH:
       - /usr/local/bin
       - /usr/bin
       ...
  </code></pre>
  
  <p>The closest thing I found in my searching was another StackOverflow question here:</p>
  
  <p><a href="https://stackoverflow.com/questions/8707697/what-version-of-ruby-use-with-cygwin">What version of ruby use with cygwin?</a></p>
  
  <p>but from what I understand of the solution, it is going to look for files with the .bat extension. Running parts of it in my cygwin to test it out doesn't produce useful results.</p>
  
  <p>Any tips on making cygwin line up with what I'm seeing in gem environment?</p>