./lib/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load — rdoc/rdoc (LoadError)
When attempting to install rubygems on a fresh Amazon Web Services EC2 instance I received the below error. Ruby had been installed by default on the instance and I was installing rubygems manually. The below error was received when attempting to run the setup.rb script with ruby.
RubyGems Install Error:
-bash-3.2# ruby setup.rb RubyGems 1.3.5 installed ./lib/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- rdoc/rdoc (LoadError) from ./lib/rubygems/custom_require.rb:31:in `require' from ./lib/rubygems/commands/setup_command.rb:352:in `run_rdoc' from ./lib/rubygems/commands/setup_command.rb:247:in `install_rdoc' from ./lib/rubygems/commands/setup_command.rb:120:in `execute' from ./lib/rubygems/command.rb:257:in `invoke' from ./lib/rubygems/command_manager.rb:132:in `process_args' from ./lib/rubygems/command_manager.rb:102:in `run' from ./lib/rubygems/gem_runner.rb:58:in `run' from setup.rb:35
I personally always like to manually compile Ruby on any server, AWS Instance, or virtual server anyway so I decided to go ahead and remove the version of Ruby that had been installed by default. So first I verified what Ruby packages had been installed by using the command below so I could be sure to remove them all.
yum list *RUBY*
The above command let me know that “ruby” and “ruby-libs” had been installed by the AWS instance image that I had used. To remove both of these packages I used the below two commands.
yum remove ruby yum remove ruby-libs
After making sure that both Ruby packages that had been installed by default were removed I downloaded the Ruby source and compiled from source. After I made sure Ruby was operational I attempted to install rubygems again by using the below command.
This time rubygems installed without issue on the Amazon Web Services EC2 instance.