title: Permission denied running a method from a Ruby gem
body: <p>I'm using a gem called <a href="https://github.com/csquared/IMGKit" rel="nofollow">IMGKit</a> and when I use the gem's <code>to_img</code> method in the console I get this error:</p>
  
  <pre><code>IMGKit::CommandFailedError: Command failed: /rubyprograms/search --format jpg http://google.com -: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/open3.rb:67:in `exec': Permission denied - /rubyprograms/search (Errno::EACCES)
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/open3.rb:67:in `popen3'
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/open3.rb:53:in `fork'
  </code></pre>
  
  <p>I have no clue what's going on.</p>
  
  <p>This is the to_img method:</p>
  
  <pre><code>def to_img(format = nil)
    append_stylesheets
    set_format(format)
  
    result = nil
    stderr_output = nil
    Open3.popen3(*command) do |stdin,stdout,stderr|
      stdin &lt;&lt; (@source.to_s) if @source.html?
      stdin.close
      result = stdout.gets(nil)
      result.force_encoding("ASCII-8BIT") if result.respond_to? :force_encoding
      stderr_output = stderr.readlines.join
      stdout.close
      stderr.close
    end
    raise CommandFailedError.new(command.join(' '), stderr_output)  unless result
    return result
  end
  </code></pre>