Gem Command Not Found

Gem Command not found

Are you wanting ruby gems? If so, you need to install libgemplugin-ruby and then the ruby 'gem' program will be in your path:

aptitude install libgemplugin-ruby

Gem installed but 'command not found'

So you're working with rbenv. According to its README, you should run rbenv rehash after installing any gems that have an executable command. Also, run it anytime you install a new Ruby version.

Built a gem but when tried it gives an error that command not found

I was able to get it to work by doing the following. I think that in your original answer you were executing popular_deals, when the command is actually popular-deals and not the same as the name of the gem!

mkdir deals_test
cd deals_test
# Contents shown below
touch Gemfile
bundle
bundle exec popular-deals

Gemfile:

source 'https://rubygems.org'

gem 'popular_deals'

I'm using MRI 2.3.3

Trying to install a gem on ruby (Windows 10)

First you should check this out if you haven't: https://rubyinstaller.org/

then on that site it has instructions on how install the development kit.

if you look at the documentation for devkit https://github.com/oneclick/rubyinstaller/wiki/Development-Kit follow the instructions

  1. cd to devkit directory
  2. ruby dk.rb init
  3. ruby dk.rb install

After those steps above try to install your gem again.

Trying to use Twurl, getting -bash: twurl: command not found in response

There isn't enough information in your post to say what happened. Rather than try to get the information from you, it's probably easier to tell you what can go wrong and let you figure it out yourself.

When installing gems, gems may include an executable file and gems may install the executable in a specific directory on your filesystem. Sometimes this works and sometimes it doesn't. For example, maybe the executable gets copied to a directory that isn't in your PATH so you can't run it from anywhere like you expect to be able to do. That's probably the case here.

I recommend that you find where twurl is installed and then add that path to your PATH and retry your operation.

  1. Run gem info twurl to get the Installed at path. Save that path for the next step.
  2. Run find PATH_FROM_PREVIOUS_STEP -name "twurl" 2>/dev/null to find the location of twurl, e.g., if the previous step said the gem was installed at /usr/bin/local/gems then you would run find /usr/bin/local/gems -name "twurl" 2>/dev/null; the output is the path to the executable, e.g., /usr/bin/local/gems/twurl/0.9.6/bin/twurl

If step 2 doesn't return the path the executable then you can retry with find / -name "twurl" 2>/dev/null to search the entire filesystem to find it.

Now that you have the path, you can run twurl one of two ways. Either use the full path every time:

$ /usr/bin/local/gems/twurl/0.9.6/bin/twurl

Or add it to your path:

$ export PATH=$PATH:/usr/bin/local/gems/twurl/0.9.6/bin/twurl

The latter option will work only for the lifecycle of your shell session. You would need to add it to your shell profile (depends on which shell you use, so no definitive answer available) so that it applies to future sessions.

Installing RubyGems in Windows

I recommend you just use rubyinstaller

It is recommended by the official Ruby page - see https://www.ruby-lang.org/en/downloads/

Ways of Installing Ruby

We have several tools on each major platform to install Ruby:

  • On Linux/UNIX, you can use the package management system of your
    distribution or third-party tools (rbenv and RVM).
  • On OS X machines, you can use third-party tools (rbenv and RVM).
  • On Windows machines, you can use RubyInstaller.

Error sudo: gem: command not found

Try without sudo. You should only use sudo if you did a root installation of ruby, which is not recommended.

Ruby works, but gem command not found - via SSH

RubyGems is in standard installation since 1.9.x so you need to install RubyGems or use RVM or rbenv to use newer version.



Related Topics



Leave a reply



Submit