ri has empty documentations – Ubuntu 11.10, Ruby 1.9 - ruby

I'm running Ubuntu 11.10 and installed Ruby 1.9 like this:
$ sudo apt-get install ruby1.9 rubygems
Everything is working very well but ri seems to have empty documentations. ri told me that the documentations were empty and I had to install them. I executed this because I read it would help:
$ rdoc --all --ri
Now, when I try to open any documentations:
$ ri Array
Nothing known about Array
I get the same for everything else I search.

what about this ?
apt-get install ri1.8
EDIT
or try this: (non rvm)
gem install rdoc rdoc-data
rdoc-data --install

You are probably using ri1.8 by default. Try running 'ri1.9.1', as you would run ruby1.9.1 when needing that specific version. Using 'update-alternatives' you should be able to set 1.9.1 as default (somehow).

this works for me
sudo apt-get install ri

"install ri" installs 1.8 (on Ubuntu 12.04 at least). Use
sudo apt-get install ri1.9

The documentations do not come immediately with Ruby installations, even up to 1.9.3. An effective shortcut to installing Ruby Documentation is to use the code:
sudo apt-get install ri
No need to specify which version as terminal will capture the documentation from the latest Ruby information, and this should work as long as you have the latest Ruby version installed on Ubuntu.

Related

Error installing Jekyll, requires Ruby >= 2.0.0

I get the error
Error installing jekyll:
jekyll requires Ruby version >= 2.0.0.
when I run
sudo gem install jekyll
"ruby -v" says I have ruby version 1.9.3
How do I install Jekyll? Do I need to upgrade ruby? If so, how?
Update - I installed ruby 2.0.0 with rvm but get the same error. Since trying to install with gem, could that still be trying to install with the older version of ruby? If so, how to find and change?
Try
sudo gem install jekyll -v 2.5
The default command apparently tries to install Jekyll 3, which was released on October 27th 2015. The 2.5 version still works with Ruby 1.9.3, and its quite allright for me, probably for you too.
I solved this issue the following way (assuming the ruby2.0 package is installed):
sudo rm /usr/bin/ruby
sudo rm /usr/bin/gem
sudo ln -s /usr/bin/ruby2.0 /usr/bin/ruby
sudo ln -s /usr/bin/gem2.0 /usr/bin/gem
Quick explanation:
/usr/bin/ruby and /usr/bin/gem are symlinks, you can check their target by entering:
ll /usr/bin/ruby
ll /usr/bin/gem
Changing the target of these links results in changing your default ruby and gem execution. Switching to version 2.0 for instance, lets you install Jekyll 3.
You can give a try to:
sudo apt-get install ruby2.0 ruby2.0-dev
sudo gem2.0 install jekyll-import
I try the following on Ubuntu 14.04:
sudo apt-get install ruby2.0 ruby2.0-dev
sudo apt-get install zlib1g-dev
sudo gem2.0 install jekyll
If you've already installed a later version of Ruby AND you're using rbenv, and gem gives the same error, it is because you are still using the old version of gem. There are now two executables called gem in your filesystem. Figure out which gem is the default with "which":
$ which gem
If you see something like */.rbenv/shims/gem, this is not the version of gems that you want to use. The correct version of gem will be in /.rbenv/versions/[your preferred version, i.e. 2.0.0]. You can run that version of gem by including the full path to the executable:
$ sudo /path/to/correct/gem install jekyll

Why can't I install ruby 1.9.2 on Ubuntu via apt-get?

apt-get install ruby
Installs ruby 1.8.7
When I install ruby 1.9.2 from sources via ./configure make install, ruby is not installed (ruby -v gives nothing).
So how can I install ruby 1.9.2 on Ubuntu?
I use rvm Ruby Version Manager on my ubuntu-10.04.1-desktop. With ruby-1.9.2 , ruby 1.8.7
no problem.
on 10.10 "Maverick Meerkat": apt-get install ruby1.9.1
on 10.04 "Lucid Lynx": Ruby 1.9.2 was only released a couple of weeks ago, it didn't exist when Lucid was frozen.
You can install ruby 1.9.1 with
sudo apt-get install ruby1.9.1
ruby 1.9.2 is not available for lucid (but I have not checked backports).
You can also proceed to upgrade the ruby installation,
as below,
sudo apt-get upgrade ruby

How do I make Ruby 1.9 the default Ruby on Ubuntu?

Is there any way, on Ubuntu 9.04, to install Ruby 1.8 as ruby1.8 (or get rid of it altogether) and have Ruby 1.9 be the default ruby?
I'm not really sure, but maybe this can help:
update-alternatives --config ruby
... and here's the non-interactive, scriptable, way:
update-alternatives --set ruby /usr/bin/ruby1.9.1
You may find out about available alternatives and respective /usr/bin/... paths by doing:
update-alternatives --query ruby
Martin - Take a look at the following link: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/
This is where installation of ruby is heading for ubuntu servers. This should allow you to not only switch to a ruby version when needed, but also keep gems separated based on ruby versions, etc.
You can completely remove Ruby 1.8 too with:
sudo apt-get remove libruby1.8 ruby1.8 ruby1.8-dev rubygems1.8
After that, you will only have Ruby 1.9 installed.
sudo \curl -L https://get.rvm.io | bash -s stable --ruby --rails
will install an up-to-date version of ruby (and rails), and allow you to avoid brokenness of Ubuntu's RVM, see https://stackoverflow.com/a/9056395/497756.
If you go this route, get rid of Ubuntu-installed versions and associated packages like bundle.
Details here: https://rvm.io/rvm/install/
(Note: this is the TL;DR version of the post by henry74.)
Try this:
sudo apt-get install ruby1.9.1 rubygems1.9.1
or try building from source. this worked for me on ubuntu 9.04 and after a restart 1.9 was the standard ruby

Installing Ruby 1.9.1 on Ubuntu?

I wonder about installing the latest version of Ruby on Ubuntu 9.04. Now I can run through the ./configure and make stuff fine, but what I wonder about: how to avoid conflicts with the packaging system? For example if some other package I install depends on Ruby, wouldn't the package manager install the (outdated) Ruby package and in the worst case overwrite my files?
So I think I need some way to tell Ubuntu that Ruby is in fact already installed?
Save yourself the headache and use RVM (Ruby Version Manager)
Keep in mind, Rails 3 works best with Ruby 1.9.2. Ruby 1.9.2 fixes up quite a few bugs in 1.9.1 and is preferable to running 1.9.1.
With RVM installing 1.9.2 is a breeze.
sudo apt-get install ruby1.9.1-full
(http://www.ruby-lang.org/en/downloads/)
After running
sudo apt-get install ruby1.9.1-full
It's solution is to run the following command:
sudo update-alternatives --config ruby
Then you will get this output:
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/ruby1.8 50 auto mode
1 /usr/bin/ruby1.8 50 manual mode
2 /usr/bin/ruby1.9.1 10 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in manual mode.
$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
Credit for this solution goes to person who answered https://askubuntu.com/questions/91693/how-do-you-uninstall-ruby-1-8-7-and-install-ruby-1-9-2 . Currently the ruby1.9.1 package is actually ruby 1.9.2.
The way I did it was to build it using checkinstall which lets you build a deb package. So I downloaded the Ruby 1.9.1 source, did a "configure" and then "make", did a "checkinstall" and made the package name ruby1.9 so it installs as if it were a new version of ruby 1.9 (as it should).
I got the Ruby specific info from this site.
You can install most software in a different directory with the --prefix=/path switch. And it is common to install in /opt/ for everyone on your pc, or in $HOME if it is only for you.
For installing in /opt:
$ ./configure –prefix=/opt/ruby
$ make install
If you want to use the /opt installed ruby, edit you ~/.bashrc and add
export PATH=/opt/ruby/bin/:$PATH
If you don't want to have the custom Ruby build as default, you can add this to your ~/.bashrc instead of the former command
function setupruby {
export PATH=/opt/ruby/bin/:$PATH
}
Here is a short and convenient way to install 1.9.1 and to make it default:
http://michalf.me/blog:make-ruby-1-9-default-on-ubuntu-9-10-karmic-koala
I created a launchpad ppa for ruby 1.9.2. Details in the links below
http://www.humbug.in/2010/launchpad-ppa-for-ruby-1-9-2-and-some-ruby-bindings/
sudo add-apt-repository ppa:pratikmsinha/ruby192+bindings
cd /etc/apt/sources.list.d/; sudo mv pratikmsinha-ruby192+bindings-lucid.list pratikmsinha-ruby192bindings-lucid.list
sudo aptitude update
sudo aptitude install ruby1.9.2
Looking through Synaptic it seems like you don't even have to deal with the Multiverse or third-party repositories. But since sudo apt-get install ruby currently installs an alias to ruby1.8, you should install ruby1.9 explicitly – manually or via the repositories – and create the alias ruby yourself.
You may want to put the binary in /usr/bin since that's where the distribution would put it anyway. Anywhere on your PATH is fine, though.

Automate a Ruby Gem install that has input

I am trying to install the ibm_db gem so that I can access DB2 from Ruby. When I try:
sudo gem install ibm_db
I get the following request for clarification:
Select which gem to install for your platform (i486-linux)
1. ibm_db 0.10.0 (ruby)
2. ibm_db 0.10.0 (mswin32)
3. ibm_db 0.9.5 (mswin32)
4. ibm_db 0.9.5 (ruby)
5. Skip this gem
6. Cancel installation
I am always going to be installing the linux version (which I assume is the "ruby" version), so is there a way to pick which one I will install straight from the gem install command?
The reason this is a problem is that I need to automate this install via a bash script, so I would like to select that I want the "ruby" version ahead of time.
You can use a 'here document'. That is:
sudo gem install ibm_db <<heredoc
1
heredoc
What's between the \<\<\SOMETHING and SOMETHING gets inputted as entry to the previous command (somewhat like ruby's own heredocuments). The 1 there alone, of course, is the selection of the "ibm_db 0.10.0 (ruby)" platform.
Hope it's enough.
Try this:
sudo gem install --platform ruby ibm_db
Note that you can get help on the install command using:
gem help install
UPDATE: Looks like this option only works for RubyGems 0.9.5 or above.
Try this, I think it only works on Bash though
sudo gem install ibm_db < <(echo 1)
#John Topley
I already tried gem help install, and --platform is not an option, both in help and in practice:
$ sudo gem install ibm_db --platform ruby
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --platform
UPDATE: The Ubuntu repos have 0.9.4 version of rubygems, which doesn't have the --platform option. It appears it may be a new feature in 0.9.5, but there is still no online documentation for it, and regardless, it won't work on Ubuntu which is the platform I need it to work on.
Versions of Rubygems from 1.0 and up automatically detect the platform you are running and thus do not ask that question. Are you able to update your gems to the latest?
$ sudo gem update --system
Be warned if you are on Windows once you have updated; you might run into this issue.
Another option is to download the .gem file and install it manually as such:
sudo gem install path/to/ibm_db-0.10.0.gem
This particular gem was at rubyforge.

Resources