Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

update-alternatives: error: alternative path /usr/bin/gem1.8 doesn't exist

Tags:

ruby

I am trying to install ruby1.8 on Ubuntu 14.04 so that I can be able to run a work application. When i run this command:

sudo apt-get install build-essential ruby1.8-dev ruby-dev mysql-client mysql-server git-core libmysql-ruby libmysqlclient-dev unzip rubygems

I get these errors below:

Building dependency tree
Reading state information... Done
build-essential is already the newest version.
git-core is already the newest version.
ruby-dev is already the newest version.
unzip is already the newest version.
libmysqlclient-dev is already the newest version.
mysql-client is already the newest version.
mysql-server is already the newest version.
ruby1.8-dev is already the newest version.
rubygems is already the newest version.
libmysql-ruby1.8 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 161 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up rubygems (1.8.25-1bbox3~trusty1) ...
update-alternatives: error: alternative path /usr/bin/gem1.8 doesn't exist
dpkg: error processing package rubygems (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
rubygems
E: Sub-process /usr/bin/dpkg returned an error code (1)
lusekero_mwathengere@lusekero:~$

Please help....I know ruby1.8 is an old version but this is what we are using at work so I need to succeed in this installation.

Thanks, in advance, for any help rendered.

like image 335
Lusekero Avatar asked Dec 04 '22 04:12

Lusekero


2 Answers

I ran into a similar error message while putting ruby on rails on AWS:

Setting up rubygems (1.8.25-1bbox3~trusty1) ...
update-alternatives: error: alternative path /usr/bin/gem1.8 doesn't exist
dpkg: error processing package rubygems (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
rubygems
E: Sub-process /usr/bin/dpkg returned an error code (1)

The solution was to manually install the library for the missing alternative path. in ubuntu:

sudo apt-get install rubygems1.8

This allowed my install script to find the requested files.

like image 141
hanmari Avatar answered May 22 '23 12:05

hanmari


This worked for me:

sudo apt-get install rubygems1.8
update-alternatives --set ruby /usr/bin/ruby1.8
like image 34
robg Avatar answered May 22 '23 10:05

robg