tag:help.rubygems.org,2010-01-19:/discussions/problems/34694-noob-unable-to-run-gem-via-terminalRubyGems.org: Discussion 2019-01-06T19:59:53Ztag:help.rubygems.org,2010-01-19:Comment/467507972019-01-04T07:23:03Z2019-01-04T07:23:03Znoob - unable to run gem via terminal <div><p><a href="https://guides.rubygems.org/faqs/#i-installed-gems-with---user-install-and-their-commands-are-not-available">https://guides.rubygems.org/faqs/#i-installed-gems-with---user-inst...</a></p></div>sonalkr132tag:help.rubygems.org,2010-01-19:Comment/467507972019-01-04T07:24:55Z2019-01-04T07:24:55Znoob - unable to run gem via terminal <div><p>Also, <a href="https://stackoverflow.com/questions/10365816/gem-installed-gems-command-is-not-found">https://stackoverflow.com/questions/10365816/gem-installed-gems-com...</a></p>
<p>Basically, find out the bin directory of installed gems and add it your $PATH. Check <code>gem env</code>.</p></div>sonalkr132tag:help.rubygems.org,2010-01-19:Comment/467507972019-01-04T14:16:56Z2019-01-04T14:16:57Znoob - unable to run gem via terminal <div><p>thank you the reply. /usr/local/bin and ./sbin are both in my $PATH and also in the shell path. Attached another screenshot showing this.</p>
<p>Please advise? there must be something simple I'm missing here ;(</p></div>fookhtag:help.rubygems.org,2010-01-19:Comment/467507972019-01-04T14:25:52Z2019-01-04T14:25:52Znoob - unable to run gem via terminal <div><p>You can see <code>INSTALLATION DIRECTORY</code> is <code>/var/lib/gems/2.3.0</code>. Check if <code>mygem</code> is present in <code>/var/lib/gems/2.3.0/bin</code>. If yes, you only need to run:<br>
<code>export PATH="$PATH:/var/lib/gems/2.3.0/bin"</code></p></div>sonalkr132tag:help.rubygems.org,2010-01-19:Comment/467507972019-01-05T00:43:36Z2019-01-05T00:43:38Znoob - unable to run gem via terminal <div><p>Hi -</p>
<p>Apologies for these late replies. I followed your instructions, essentially adding <code>../bin</code> to my <code>$PATH</code>. Unfortunately it proved unsuccessful. I have attached another screenshot, showing this.</p></div>fookhtag:help.rubygems.org,2010-01-19:Comment/467507972019-01-05T01:30:20Z2019-01-05T01:30:22Znoob - unable to run gem via terminal <div><p>Apologies: [mygem] is not in <code>/var/lib/gems/2.3.0/bin</code>. (But it is in <code>/var/lib/gems/2.3.0/gems</code> ) Should I edit my .<code>~/.bashrc</code> file to include <code>/var/lib/gems/2.3.0/bin</code>?</p>
<p>However, FYI none of my other installed gems are in <code>../bin</code> and they work off my terminal ok.</p></div>fookhtag:help.rubygems.org,2010-01-19:Comment/467507972019-01-05T16:52:06Z2019-01-05T16:52:06Znoob - unable to run gem via terminal <div><p>What does your gemspec look like?</p></div>kerrizortag:help.rubygems.org,2010-01-19:Comment/467507972019-01-05T23:49:01Z2019-01-05T23:49:02Znoob - unable to run gem via terminal <div><p>pretty standard. No problems in the building the gem with <code>gem build [gem.gemspec]</code>. I also published without problem, with <code>gem push [gem-ver_num.gem]</code> .</p>
<p>Full disclosure, I deleted the gem from my computer and did <code>gem install [mygem]</code> in the attempt to diagnose the problem. So I retyped the gemspec from memory.</p>
<p>Again: <code>require '[mygem]'</code> in irb works...</p></div>fookhtag:help.rubygems.org,2010-01-19:Comment/467507972019-01-06T19:59:51Z2019-01-06T19:59:51Znoob - unable to run gem via terminal <div><p>I'm guessing it might be that you're missing a <code>gem.executables</code> declaration in your gemspec.. here's a link to our docs on building gems with command-line executables.. hopefully that'll get you pointed in the right direction, and give you some other avenues to explore!</p>
<p><a href="https://guides.rubygems.org/make-your-own-gem/#adding-an-executable">https://guides.rubygems.org/make-your-own-gem/#adding-an-executable</a></p></div>kerrizor