I'm trying to move from ruby 1.8 to 1.9 something.
I have tried installing the newer ruby in a number of ways - with rvm, with apt-get, etc. No matter which way I do it, once I've got /usr/bin/ruby pointing at that, no gems can be loaded ("no such file to load").
I have tried reinstalling them, both as super user and regular, and the gem install command finishes successfully, but it still doesn't find them.
I have also installed rubygems1.9.1
Can someone please tell me what's wrong. This is insanely frustrating - I have installed every gem several times in many many places and yet it doesn't find any of them. I have tried setting GEMS_DIR to no avail as well.
Remove every Ruby installation you got. Be sure there are no 'ruby' and 'gem' executables anywhere.
Install RVM and check if it went well
Install all the dependencies listed in rvm notes output.
Do rvm install 1.9.2 and start installing your gems.
Related
I'm on Kali linux and I have a script that runs gem update --system. However I get the following error:
ERROR: Your RubyGems was installed trough APT, and upgrading it through RubyGems
itself is unsupported. If you really need the latest version of RubyGems (tip:
you usually don't), then you need to install RubyGems (and Ruby) manually,
maybe using tools like ruby-install, rvm, etc.
I have never touched Ruby in my life but I've done some research to try and solve the problem myself. I tried to download the rubygems .tgz file from this link here, extracted it with tar, and followed the only step there was, ruby setup.rb. I then tried gem update --system again but I got the same error. Then I decided to try and remove rubygems with apt like this: apt purge rubygems, but it said, NOTE: selecting 'ruby' instead of 'rubygems' and it did nothing. Then I tried to completely remove ruby with apt purge ruby but not only does it remove ruby, but other programs. Here's what apt says:
Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
bundler* libruby2.7* metasploit-framework* rake* ruby* ruby-bundler*
ruby-dev* ruby-rubygems* ruby2.7* ruby2.7-dev*
0 upgraded, 0 newly installed, 10 to remove and 0 not upgraded.
After this operation, 423 MB disk space will be freed.
Do you want to continue? [Y/n]
I don't want to remove all versions of ruby nor do I want to remove the metasploit-framework or bundler since I might need them. To sum up, does anyone know how to manually install rubygems and get gem update --system to work?
I suggest using RVM (https://rvm.io/).
Using RVM, you can have different ruby installations, each with their own version of Ruby Gems. This is installed locally (in your home directory) and RVM manages your PATH variable so that you can switch between installations and gem sets (basically multiple local gem repositories, which is very useful for doing different projects).
I have not worked on Kali Linux, but you should be able to follow the process easily here: https://rvm.io/rvm/install
Take a few minutes to learn the RVM commands to install new Rubies and switch between them and managing gem sets. I believe it's worth it.
I'm having problems installing json or rmagick gems on Windows, which I need because I am trying to install Redmine 2.1.4.
As none of the procedures worked out-of-the-box for me and have struggled with it myself for a couple of hours, I thought I'd just ask here for help.
I'm assuming you don't have Ruby installed yet. If you do, as any of other components mentioned below, probably it's the wisest to uninstall them before proceeding with installation.
This tutorial should help you avoid problems with json and rmagick gems on Windows.
First, download Redmine 2.1.4 from rubyforge as zip or from SVN or Git as described on the relevant Redmine Wiki page. rubyforge tends not to work, so you can be forced to use the latter.
Download RubyInstaller (1.9.3 at the time of this writing) and DevelopmentKit from rubyinstaller.org
Install Ruby using the downloaded installer. Use a directory without spaces in name, i.e. don't install it to Program Files. I checked the options as below
Open command line, check if Ruby path has been added to your system. ruby --version should show the version installed, 1.9.3 in my case. If you had command line opened while installing Ruby, close and reopen it to load path.
Extract DevKit to a path with no spaces. Change to DevKit's directory (might be e.g. under Ruby's installation, i.e. C:\Ruby193\DevKit). Execute the following:
ruby dk.rb init
ruby dk.rb review (should detect Ruby's installation path correctly)
ruby dk.rb install
Install bundler gem gem install bundler
Go to Redmine home directory. Execute bundle install. You will probably (if not yet fixed) get the rmagick error - don't worry yet.
Go get ImageMagick. I picked ImageMagick-6.8.0-7-Q16-windows-dll.exe. Install to a directory whose path doesn't include spaces, e.g. C:\ImageMagick. Choose to install header files as well, as below:
Add ImageMagick home to path. Close command line and reopen it. This will reload path.
Execute `gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick/lib --with-opt-include=c:/ImageMagick/include
Go to Redmine home directory again. Execute bundle install again. Should work now.
Hope that helps!
I'm having trouble running a gem on system ruby -- I've done the install, and the gem runs when rvm runs 1.9.2, but doesn't run on rvm system, though that too is 1.9.2. The OS is OSX 10.6.8.
One importance difference seems to be GEM_HOME, as seen in rvm info. This is set for rvm 1.9.2, to values in ~/.gemrc, but not set for rvm system.
So at a guess, the system ruby isn't reading the .gemrc file.
Is there anyway to verify this?
How can I correct it?
The system ruby was installed from source.
The gem in question is compass, version 0.12.1. An install of 0.11.5 also failed.
Also, gem -v is 1.5.3. That's a rollback, I was using 1.8.24 but that too failed and I rolled back to a prior to see if that helped.
The system Ruby doesn't know about any gems you've installed in RVM managed Rubies, nor will it care about a .gemrc file.
The system Ruby stands alone, and for most purposes should be left as it was installed by Apple unless you reeeeeeally know why it's there and what it affects. Apple had their own reasons for installing Ruby and at least one app installed by Apple by default on a Mac OS machine requires it. We're free to use it, but deleting it will break that app, and updating it could cause problems that possibly won't surface immediately, so I think it's best to just ignore it.
If I need a system-wide Ruby for a Mac, I'd install it from source into /usr/local/bin, which is the appropriate place for a replacement. For my own development, I use RVM or rbenv, and let them install in my home directory, which is their default. That way I'm free to mess around to my heart's content, and even blow them away, without any chance of affecting the system.
By the way, the version of Ruby isn't important, it's what installed it and where it's installed.
Hopefully an easy one - started using rvm and one of the benefits it gives aside from easily switching between gemsets and ruby versions is that I no longer need to install new gems under root (So, no need for sudo). Back when I used to do that, the way i got to my gem docs was by running;
gem server
which gave me a home-hosted site so i could browse the documentation. Now, when I install a gem I don't need to do it under root,
#so it's just
gem install hpricot
but when I then run gem server, it only lists those gems I've installed under root. So what I'm finding myself doing is;
gem install hpricot #to get the gem under rvm
sudo gem install hrpicot #so i can still use gem server
Am I missing something or is this just how it is? I work a lot offline so really need those local docs.
Running gem server under a particular ruby/gemset works well for me. Check rvm info to make sure your shell vars are pointing to the correct ruby/gemset. Also, which version of rvm are you running? I've ran rvm get head a few weeks ago and the version it's showing for me is rvm 1.9.2.
I followed 2 different guides to install ruby on OSX and I think I messed some things up. Now that I know what I'm doing a bit more I have a feeling something is wrong. I'd like to 'start fresh' but i dont know what to remove safely (I dont mind re-installing everything. I have nothing super important)
I first used rvm and then decided i wanted to use homebrew. I uninstalled rails with rvm and then 'imploded' rvm. I then installed homebrew and then brew install rails 1.9.3
Although... when i run gem install xxx, all my gems seem to be in a weird path?
For instance, sinatra.rb is installed here:
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.1/lib
Notice it says 1.9.1, yet when I run
ruby -v
I get 1.9.3p0
and which ruby i get this
/usr/local/Cellar/ruby/1.9.3-p0/bin/ruby
If i do which [rails,git,mysql,whatever]
they all seem to point to Cellar.
as a sidenote, i have two versions of sinatra.rb on my computer... this is where the other one is (although the one I'm pretty sure it's not using).
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/sinatra-1.2.0/lib
kind of ridiculous...
I'm not sure whats going on here.
This is my path if that helps:
export LSCOLORS="GxGxBxDxCxEgEdxbxgxcxd"
export CLICOLOR=1
export PATH=/usr/local/Cellar/ruby/1.9.3-p0/bin:/usr/local/mysql-5.5.18-osx10.6-x86_64/bin:/usr/local/bin:$PATH
That's fine. You are using 1.9.3. The gems are installed under a 1.9.1 directory, to distinguish them from gems installed for 1.8.7 (some gems that work with the 1.9 series don't with 1.8, and vice-versa). 1.9.1 was the first released version of the 1.9 series.