Installing Ruby 1.9.3 in Ubuntu giving errors - ruby

I had to do a lot of juggling when I tried to install Ruby 1.9.3, and it is mentioned in community that ruby1.9.1 is the package to be installed for Ruby 1.9.3. Now, if i run ruby, I get
<internal:gem_prelude>:1:in `require':
cannot load such file -- rubygems.rb (LoadError)
from <internal:gem_prelude>:1:in `<compiled>'
What can I do?
FYI, I uninstalled everything in my comp by sudo apt-get remove --purge ruby1.8 libruby1.8
Then I installed Ruby1.9.1 by sudo apt-get install ruby1.9.1 libruby1.9.1
What do i do?
EDIT:
After the comments, I used rvm to install newer ruby 1.9.3, ANd now everything is perfect.
MORAL:
dont use apt-get for ruby. Use rvm, gem and other ruby tools. It's brilliant.

If you installed Ruby system-wide with apt then the latest RubyGems won't be included in the install. Ruby is the language, RubyGems is the package manager which has to be installed separately.
To install RubyGems just go here and follow the instructions:
Download from above.
Unpack into a directory and cd there
Install with: ruby setup.rb (you may need admin/root privilege)
For more details and other options, see: ruby setup.rb --help

Related

how to update gem command in ubuntu?

my gem version is 1.3.5 and I can't install certain gems because of that.I tried to update the gem on my computer by
sudo update --system
and it gives me an error
ERROR: While executing gem ... (RuntimeError)
gem update --system is disabled on Debian.
RubyGems can be updated using the official
Debian repositories by aptitude or apt-get.
so according to some people, the source need to be downloads and it needs to executed by ruby. i downloaded the file, did
sudo ruby setup.rb
and it gave me
RubyGems 1.8.24 installed
== 1.8.24 / 2012-04-27
1 bug fix:
Install the .pem files properly. Fixes #320
Remove OpenSSL dependency from the http code path
RubyGems installed the following executables:
/usr/bin/gem1.8
but when I hit ruby gem -v it still gives me 1.3.5 rather than the one I installed which is 1.8.
Do I need to uninstall the older version manually? or some other thing I need to do first?
RubyGems installed the following executables: /usr/bin/gem1.8
As the line says, the name of the program is gem1.8, not gem. Ergo, you need to call
gem1.8 -v
not
gem -v
Please try make a symbolic link.
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

How can I install the dicom gem using rvm on ubuntu 11?

I have rvm installed, and the default set to 1.9.2. Whenever I try to get the dicom gem, I get these error messages:
$ rvmsudo gem install dicom
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
These errors happen after I run the instructions here, ie:
$ rvmsudo rvm remove ruby-1.9.2
$ rvmsudo rvm pkg install zlib
$ rvmsudo rvm install ruby-1.9.2
$ rvmsudo --default use 1.9.2
These errors also happen after removing all sudo apt-get installed ruby versions (ie, I ran sudo apt-get remove ruby*), and uses the most recent rvm (1.8 as of this question)
RVM instructions tell that you have to install ruby this way
rvm install 1.9.2 --with-zlib-dir=$rvm_path/usr
after installing zlib package

I'm confused, what's the easiest way to install Ruby 1.9.2 on OS X?

My current version is ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10]
Step 1. Install Homebrew: https://github.com/mxcl/homebrew
This enables you to install various *IX projects on a mac. You may need to install xcode as part of this, so you may need your OS X disc to hand. Homebrew is useful for many other things - a good thing to have installed anyway.
Step 2. Install Ruby Version Manager:
brew install rvm
Step 3. Install whichever Ruby version you want. This means you can have multiple Ruby installations (with their own sets of rubygems) running independently of one another. for 1.9.2 try this:
rvm install 1.9.2
If you get a 'readline' error, try this:
rvm package install readline
rvm remove 1.9.2
rvm install 1.9.2 --with-readline-dir=$rvm_path/usr
You should now be able to do this to test your ruby version:
ruby --version
To switch back to another version of ruby, just use the rvm command.
You can try rvm to install whatever the version of ruby.
if you will get error
undefined method `path' for Gem:Module (NoMethodError)
during command
~/rubygems-1.3.7 $ ruby setup.rb
remove ruby and rubygems with command
sudo autoremove ruby
sudo autoremove rubygem
ant try to install all again

Debian + Ruby1.9 problem

I installed ruby 1.9.1 on my Debian Squeeze. After that I tried to install ruby gems, but
aptitude why-not rubygems1.9.1
i ruby1.9.1 Conflicts rubygems1.9.1
I have /usr/lib/ruby/1.9.1/rubygems/ in my filesystem, but I havn't any binary file like rubygems1.9.1 or gems. What shall I do?
Just run the gem1.9.1 command anyway. The reason ruby1.9.1 conflicts with rubygems1.9.1 is because rubygems has been integrated into the ruby1.9.1 package.

json_pure/rubygems cyclic dependencies

I have an issue when trying to set up rvm, where gems weren't installing due to them being dependent on json_pure. I tried to install json_pure, but rubygems itself seems to depend on json_pure. I have tried removing all versions of json_pure, but rubygems still complains.
$ sudo gem install json_pure
/Library/Ruby/Site/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem json_pure (>= 0) (Gem::LoadError)
I have tried downloading the gem and installing it locally, but rubygems still complains about the dependency.
I had this exact problem, and the above solutions didn't work for me. (I don't use rvm, and re-installing RubyGems didn't resolve the issue.)
This is what I did to fix my setup on my Mac. (Ruby 1.8.6, Mac OS X 10.5.8)
1) Go to http://rubygems.org/gems/json_pure
2) Download the json_pure gem to ~/Downloads
3) cd ~/Downloads/
4) sudo gem install json_pure-1.4.6.gem
(You'll still see the "Could not find RubyGem json_pure" error, but the install does work. To double-check you can redo 'sudo gem install json_pure-1.4.6.gem' and you shouldn't see the error the second time.)
5) Verify that json_pure is now installed:
gem list
I fixed this issue by copying the json and json_pure gems and their specs from a working ruby directory into the .rvm gem directory of the broken ruby. Not sure why rubygems itself ever relies on another gem.
cp -r ~/.rvm/gems/ruby-1.8.7-p249/gems/json* ~/.rvm/gems/ruby-1.8.6-p399/gems/
cp -r ~/.rvm/gems/ruby-1.8.7-p249/specifications/json* ~/.rvm/gems/ruby-1.8.6-p399/specifications/
I can't understand if you are having an issue installing RVM or using RVM.
If you need to install RVM, don't use sudo.
Just type
$ gem install rvm
RubyGems will install it in your home directory.
Then, proceed with rvm-install and follow the instructions.
When using RVM, never use sudo.
This issue came about when I removed all the json-pure versions in my main $PATH. To resolve the issue I reloaded RubyGems 1.3.7 from source and was able to reinstall the json-pure gem. Note: I was not using RVM.
Steps:
1) Download RubyGem 1.3.7.tgz
2) Use these commands at the command prompt
tar xzvf rubygems-1.3.7.tgz
cd rubygems-1.3.7
sudo /opt/local/bin/ruby setup.rb
3) Try a gem command
gem list
4) If it works, install the json-pure gem // might need to install the json gem also.
sudo gem install json
sudo gem install json-pure

Resources