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
- cd to devkit directory
ruby dk.rb init
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.
- Run
gem info twurl
to get the Installed at path. Save that path for the next step. - Run
find PATH_FROM_PREVIOUS_STEP -name "twurl" 2>/dev/null
to find the location oftwurl
, e.g., if the previous step said the gem was installed at/usr/bin/local/gems
then you would runfind /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
What Does Class_Eval ≪≪-"End_Eval", _File_, _Line_ Mean in Ruby
Why Are Methods in Ruby Documentation Preceded by a Hash Sign
How to Use Define_Method to Create Class Methods
Nokogiri Gem Installation Error
Eoferror: End of File Reached Issue With Net::Http
To Use Self. or Not.. in Rails
Ruby/Rails - Change the Timezone of a Time, Without Changing the Value
Undefined Method 'Visit' When Using Rspec and Capybara in Rails
Difference Between $Stdout and Stdout in Ruby
How to Implement a Short Url Like the Urls in Twitter
Execute Bash Commands from a Rakefile
Unzip (Zip, Tar, Tag.Gz) Files With Ruby
In Rails, How to Add a New Method to String Class
How to Create a Sha1 Hash in Ruby
How to Get Ruby/Homebrew/Rvm to Work on Yosemite
Why Are My Basic Heroku Apps Taking Two Seconds to Load
Equivalent of .Try() for a Hash to Avoid "Undefined Method" Errors on Nil