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.
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. Gem's command is not found
On some systems (e.g., Debian) the path where the gem executables are installed to are not in the $PATH
. Dependingmon your distribution, that path is on a different location, on Debian with the system Ruby, it is at /var/lib/gems/1.8/bin
. To add that to the system's $PATH
, put something like this into a new file in /etc/profile.d/rubygems.sh
export PATH="$PATH:/var/lib/gems/1.8/bin"
Install gem gives Failed to build gem native extension.
You need to install make
and other build tools first, run this:
sudo apt-get install build-essential
Ruby Gems returns command not found
Your $PATH
variable needs to include the exact path to your Ruby's bin directory. Adding a directory to the PATH
does not include it's subfolders. Try adding the bin directory via:
export PATH=$PATH:/home/adam/.gem/ruby/1.8/bin
or if you installed the gem using sudo
:
export PATH=$PATH:/usr/lib/ruby/gems/1.8/bin
You might want to add this to your .bashrc
file, so that you don't have to set this manually every time your open up a new bash.
How to install a gem or update RubyGems if it fails with a permissions error
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
means exactly that, you don't have permission to write there.
That is the version of Ruby installed by Apple, for their own use. While it's OK to make minor modifications to that if you know what you're doing, because you are not sure about the permissions problem, I'd say it's not a good idea to continue along that track.
Instead, I'll strongly suggest you look into using either rbenv or RVM to manage a separate Ruby, installed into a sandbox in your home directory, that you can modify/fold/spindle/change without worrying about messing up the system Ruby.
Between the two, I use rbenv, though I used RVM a lot in the past. rbenv takes a more "hands-off" approach to managing your Ruby installation. RVM has a lot of features and is very powerful, but, as a result is more intrusive. In either case, READ the installation documentation for them a couple times before starting to install whichever you pick.
Related Topics
Ruby: What Does the Comment "Frozen_String_Literal: True" Do
How to Understand the Difference Between Class_Eval() and Instance_Eval()
Paperclip::Errors::Missingrequired
validatorerror With Rails 4
Ruby 1.9.2 and Rails 3 Cannot Open Rails Console
Why Doesn't My Cron Job Work Properly
Using God to Monitor Unicorn - Start Exited with Non-Zero Code = 1
Ruby: Class Instance Variables VS Instance Variables
Setspeed in Selenium Webdriver Using Ruby
What's the Precedence of Ruby'S Method Call
How to Avoid Trailing Empty Items Being Removed When Splitting Strings
Google Plus API Shutdown Today, Which Alternative Can Be Used to Authentication
How to Add an Array to Another Array in Ruby and Not End Up With a Multi-Dimensional Result
How to Do Relative Time in Rails