Gem Command not found - ruby

I have installed gem on Ubuntu 10.10 32 bit with
apt-get install gem -y
But when I try to run
gem install something.gem
I get the error of the command not being found.
bash: gem: command not found
I installed gem, is there any reason it is saying it can't find the command?
These files were install by gem package
http://pastie.org/3483416

Try the following:
sudo apt-get install rubygems

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

The following command installs ruby gem for ubuntu:
apt-get install libgemplugin-ruby
I did it after ruby was installed.

Installing this package allows you to use gem command on Debian 8:
apt-get install rubygems-integration
To install a gem package you might also need:
apt-get install ruby ruby-dev

On Debian, Ubuntu or Linux Mint:
$ sudo apt-get install rubygems ruby-dev
On CentOS, Fedora or RHEL:
$ sudo yum install rubygems ruby-devel

FWIW, the equivalent package for RHEL/Fedora/CentOS/etc and SuSE/OpenSuSE appears to be called 'rubygems'.

The following command may help you
sudo apt-get install ruby

On Ubuntu 14.04,
apt-get install ruby ruby-dev
this will install gem for you.

On CentOS 7 you can do:
yum -y install rubygems-devel
That worked for me.

I had the same problem. What I did was:
sudo apt-get update
And then reinstall ruby-full
sudo apt-get install ruby-full

check that rvm is a function type rvm | head -1

I know this is kind of late for a response. But I did run into this error and I found a solution here:
https://rvm.io/integration/gnome-terminal
You just have to enable 'Run command as login shell' under the terminal preferences.

The following command will give you the list of files that the gem package installed:
dpkg -L gem
that should help you troubleshoot.

try
$ /usr/bin/pd-gem
or
$ pd-gem

On Centos 8:
eventually, download the file of the application:
wget https://rubygems.org/downloads/asciidoctor-2.0.16.gem
then execute:
yum install -y rubygems ruby-devel
gem install asciidoctor
More: I tried positively also in a container (using the appropriate RUN and COPY statements before the commands).

Related

Installing Ruby on Linux

I want to install only Ruby, not Ruby on Rails, I check this command:
sudo apt-get install ruby-full -g
But the terminal report me this error:
E:Command line option 'g' [from -g] is not known
This command will install the latest stable Ruby version and will make it
available globally (through the '-g' parameter) on your system environment...
Why do I get this error?
Update your package manager first:
sudo apt-get update
This must finish without error or the following step will fail.
Install curl:
sudo apt-get install curl
You’ll use curl for installing RVM.
Install RVM
curl -L https://get.rvm.io | bash -s stable --ruby
You Already Have RVM Installed
If you already have RVM installed, update it to the latest version and install Ruby:
rvm get stable --autolibs=enable
Install Ruby:
rvm install ruby
apt-get install ruby-full
apt (Debian or Ubuntu)
Debian GNU / Linux and Ubuntu use the apt package manager. You can use it as follows:
font: https://www.ruby-lang.org/pt/documentation/installation/
-g is not an option of apt-get. There is nothing like "global" install in apt-get. Everything is installed globally. If you want to install the ruby-full package, just do
sudo apt-get install ruby-full
Another option is to install ruby via rvm.io or rbenv

Failed to build gem native extension when install RedCloth-4.2.9 install Linux

I want to install Octopress in my computer.
I try to do it like
Octopress document.
When I run
bundle install
I got error message
An error occured while installing RedCloth (4.2.9), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
So, I run
sudo gem install RedCloth -v '4.2.9'
then, I got a error message again:
ERROR: Error installing RedCloth:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
I hadn't learn any knowledge about ruby.
My ubuntu 12.04 solution is install the ruby1.9.1-full version, that can resolve this issue.
sudo apt-get install ruby1.9.1-full
you can execute command:
sudo update-alternatives --config ruby
to select the altiernative ruby which you have installed.
and then, execute below commands to finish the octopress deploy:
git clone https://github.com/erizhang/octopress.git octopress
cd octopress/
sudo gem install bundler
sudo gem install RedCloth -v '4.2.9'
bundle install
rake install
below commands you can find from octopress deploy guideline page:
rake setup_github_pages
sudo rake setup_github_pages
sudo rake generate
sudo rake deploy
Hope it's helpful for you, thanks
I was installing Octopress too and got the same problem as yours. After checking the mkmf.log file I figured out that gcc-4.2 had not been found. I Even installed xcode with the command line tools. It worked when I made a symlink like this:
$ sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
$ bundle install
I fixed this issue by running
sudo apt-get install ruby-dev
as described in this blog post.
You've probably upgraded to Mountain Lion and have not rebuilt your ruby-1.9.2 install yet with the new development packages.
rvm --force install 1.9.2
gem install bundle --no-ri --no-rdoc
bundle install
If you don't have the Mountain Lion dev packages installed correctly, use the ThoughtBot instructions.
For Ubuntu 14.04 simply do this:
sudo apt-get install ruby1.9.3
Should work for 13.10 and 13.04 too. (Not tested)
it apears you are not using rvm for managing your ruby installation. I think best would be to try rvm, here's a very good guide, you can stop without installing rails: ruby with rvm
Then simply
$gem install RedCloth
Unmanaged ruby gems are a pain, I try to avoid them.
None of the answers worked on my Ubuntu 14.04.1 LTS. Upgrade to ruby 2.0 fixed the problem for me:
sudo apt-get install ruby2.0 ruby2.0-dev
sudo ln -s /usr/bin/ruby2.0 /usr/bin/ruby
sudo ln -s /usr/bin/gem2.0 /usr/bin/gem
sudo gem install bundler
Make sure you also have the build-essential package installed. You can check using
dpkg -l | grep build-essential
or simply install it without checking
sudo apt-get install build-essential
For me on Ubuntu 14.04.1 LTS, after making sure build-essential is installed, the bundle install command works/builds fine also with Ruby 1.9.3.

Installing opencv on Ubuntu - can't find libopencv_calib3d

I successfully installed Opencv via
sudo apt-get install libcv-dev libcv4 libcvaux-dev libcvaux4 libhighgui-dev libhighgui4 opencv-doc python-opencv
But now when I try to use ruby-opencv I keep getting
libopencv_calib3d not found.
error
What am I missing?
On Ubuntu 14.04 I had this issue, which was resolved using:
sudo apt-get install libopencv-dev
Try also
sudo apt-get install libopencv-calib3d2.3
Add libopencv-calib3d-dev if you need to compile the Ruby bindings yourself.

Error with rhc-create-domain on command line (Openshitft)

First I do not know much about Ruby, but, the Openshit command line uses the 'rhc' to manage my apps on cloud. Nice!...but the 'rhc' program its based on Ruby, Rubygems....something.
Ok, i'm installed theses programs with apt-get on Linux Mint (Ubuntu based):
sudo apt-get install ruby1.8
sudo apt-get install gem
sudo apt-get install rubygems
gem install json_pure
gem install rake
gem install rhc
Nice!..rhc its visible in my console, but when i try execute any rhc command, the console returns for me this:
rhc-create-domain -n carlosjr -l carlosjrcabello#gmail.com
/usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find rhc (>= 0) amongst [json-1.6.6, json_pure-1.6.6, mime-types-1.18, parseconfig-0.5.2, rest-client-1.6.7] (Gem::LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems/dependency.rb:256:in `to_spec'
from /usr/local/lib/site_ruby/1.8/rubygems.rb:1231:in `gem'
from /usr/local/bin/rhc-create-domain:18
Remembering, i do not know if I have to update something in ruby or RubyGem.
No more for now. Thanks.
I solved the problem. The Linux Mint 12 (Lisa) with KDE contains the basic Ruby packages installed, so I purged all ruby packages before installing all required RHC apps. Here is my solution (in command line):
sudo apt-get purge ruby* (caution with grub packages)
sudo reboot
sudo apt-get install ruby1.8
sudo apt-get install gem
sudo apt-get install rubygems
gem install json_pure
gem install rake
gem install rhc
All rhc functionalities should now be working.
PS: I think that Openshift can be explain more the install process of Ruby apps..using my case for example, I dont have anything knowledge of Ruby :/
I had the same error message on Ubuntu 12.04. In my case the problem was /var/lib/gems/ was not world readable.

Ruby: Installing rmagick on Ubuntu

I'm trying to get RMagick setup on Ubuntu 10.04. Looked here but had no joy. I even compiled and installed ImageMagick from source, but the instructions here still didn't help me when I try to install RMagick using RubyGems. I got this error:
carcher#carcher-laptop:~/Code/temp/RMagick-2.13.1$ sudo gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
carcher#carcher-laptop:~/Code/temp/RMagick-2.13.1$
What does it all mean? :) I'm new to Ruby and RubyGems so please be gentle. My setup is as follows:
Ruby: 1.8.7
RubyGems: 1.3.7
I'm pretty much out of ideas (and tired too!). I tired to compile RMagick from source using the link above but it failed as there was no ./configure script :(
Any and all help appreciated!
Install the packages imagemagick and libmagickwand-dev (or libmagick9-dev). You should then be able to install the Rmagick Gem.
sudo apt-get install imagemagick libmagickwand-dev
If not, you are missing ruby related development packages like build-essential and ruby1.8-dev. If that's the case, a generic "ubuntu install ruby 1.8" query in google should sort you out.
You don't need a lot of the other junk in these answers, just:
sudo apt-get install libmagickwand-dev
On Ubuntu 12.04 libmagick9-dev is gone. graphicsmagick-libmagick-dev-compat should be used instead.
apt-get install graphicsmagick-libmagick-dev-compat
On Ubuntu 15.04, what solved it for me was to remove all previous *magick installations, reinstall required packages and then symlink the config file:
sudo apt-get purge graphicsmagick graphicsmagick-dbg imagemagick-common imagemagick imagemagick-6.q16 libmagickcore-6-headers libmagickwand-dev graphicsmagick-libmagick-dev-compat
sudo apt-get autoremove
sudo apt-get install imagemagick libmagickwand-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config
gem install rmagick
In Ubuntu 14.04
Below code is worked for me
sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev
Then,
gem install rmagick
On Ubuntu 12.0.4.2 sudo apt-get install libmagickwand-dev libmagickcore-dev libmagickcore4-extra libgraphviz-dev libgvc5 worked for me.
graphicsmagick-libmagick-dev-compat installed but didn't include the header files so rmagick wouldn't compile.
Please note, you need to remove graphicsmagick-libmagick-dev-compat before running the command above.
this worked for me...
sudo apt-get install graphicsmagick-libmagick-dev-compat libmagickwand-dev
gem install rmagick
...
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed
(ubuntu 12.0.4 64bit)
You got message extconf.rb:1:in 'require': no such file to load -- mkmf (LoadError) because package ruby1.8-dev isn't installed. Install it (sudo apt-get install ruby1.8-dev) and try again.
In Ubuntu 13.10
This code worked for me
sudo apt-get install graphicsmagick-libmagick-dev-compat libmagickwand-dev
gem install rmagick
To get bundle to stop failing on ubuntu 12.04.
apt-get install graphicsmagick-libmagick-dev-compat libmagickwand-dev
This is my gemfile
gem 'rmagick'
gem 'mini_magick'
On Ubuntu, you can run:
sudo apt-get install libmagickwand-dev
On Centos, you can run:
sudo yum install gcc ImageMagick-devel make which
Then install
gem install rmagick
If you want to try installing the native deb package instead of the gem, be aware that the librmagick-ruby was broken on Ubuntu 10.04 until just very recently:
https://bugs.launchpad.net/ubuntu/+source/librmagick-ruby/+bug/518122
See comment #17 in particular. I believe this has already been fixed so now apt-get install librmagick-ruby might "just work". Otherwise here's how to build it yourself from source
$ cd /usr/src
$ sudo apt-get build-dep librmagick-ruby
$ sudo apt-get source librmagick-ruby
$ cd librmagick-ruby-2.11.1
$ sudo dch -i
(add changelog entry)
$ sudo dpkg-buildpackage
$ cd ..
$ sudo dpkg -i librmagick-ruby*.deb
In ubuntu 16.04.3:
This i worked:
sudo apt install imagemagick imagemagick-6.q16
It means this installed imagemagick then you can run RMagick.
If you are using Linux then simply run these commands.
sudo apt-get install imagemagick libmagickwand-dev
and then
bundle install
Hope this will resolve your issue.
And if you are using mac then simply run following commands
First of all unlink your installed imagemagick which was not properly installed in latest mac high sierra by using.
brew unlink imagemagick
then install latest imagemagic6 using below command
brew install imagemagick#6 && brew link imagemagick#6 --force
Then install gem rmagick using below command
gem install rmagick
bundle install
It will work perfectly fine.
Follow below 3 steps proven on UBUNTU 16.04
sudo apt-get install build-essential imagemagick libmagickwand-dev
#In .bashrc or .bash_profile add below code. Just check the ImageMagick dir name.
export PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH"
gem install rmagic #Install Gem

Resources