title: How to use pry-byebug in an example script for a gem?
body: <p>I'm working on making my first gem, which is not a Rails app, is a tic-tac-toe library with some AI in it, so I can play a computer opponent that will never lose and force a win if possible.</p>
  
  <p>Right now I am trying to debug the attack strategy in the AI, but I can't seem to figure out how to get pry-byebug working in my test script, specfically, have the debugging commands like <code>step</code>, <code>next</code>, etc. work upon hitting a <code>binding.pry</code>.</p>
  
  <p>The gem, named smart-tac-toe, has the following directory structure:</p>
  
  <pre><code>$ ls smart-tac-toe
  example  Gemfile  Gemfile.lock  Guardfile  lib  LICENSE.txt  Rakefile  README.md  smart_tac_toe.gemspec  spec  tmp
  </code></pre>
  
  <p>As you can see above, there is an 'example' directory in my gem which contains "example.rb", where I use the classes I've made.</p>
  
  <p>However, when I use <code>binding.pry</code> and try to use <code>step</code> and <code>next</code>, the Pry session just exits  and the script keeps running.</p>
  
  <p>In my smart_tac_toe.gemspec file, I clearly have pry-byebug:</p>
  
  <pre><code>spec.add_development_dependency "pry-byebug", '~&gt;2.0.0'
  </code></pre>
  
  <p>and at the top of my example.rb file, I have tried requiring the proper gems:</p>
  
  <pre><code>require 'pry'
  require 'pry-byebug'
  require "../lib/smart_tac_toe.rb"
  </code></pre>
  
  <p>I am using Ruby 2.1.1p76 , the repo for this gem is located at <a href="https://github.com/discotroll65/smart_tac_toe" rel="noreferrer">https://github.com/discotroll65/smart_tac_toe</a></p>
  
  <p>Also, though putting binding.pry into my example script does throw me into a debugging session, initially it is in a reading mode, and I have to press <kbd>q</kbd> to exit that before I can start doing repl stuff. Any thoughts as to why this may be?</p>