Rails: I installed Ruby, now "bundle install" doesn't work - ruby

I’m using Rails 4.2.7. I downloaded an example that evidently requires me to use Ruby 2.1.6 rather than the Ruby 2.3.0 version I had installed …
localhost:lti_tool_provider_example-master davea$ bundle install
Your Ruby version is 2.3.0, but your Gemfile specified 2.1.6
So that’s what I did. However after installing Ruby 2.1.6, now “bundle install” doesn’t work …
localhost:lti_tool_provider_example-master davea$ rvm install ruby-2.1.6
Warning! PATH is not properly set up, '/Users/davea/.rvm/gems/ruby-2.3.0/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.3.0'.
Warning, new version of rvm available '1.27.0', you are using older version '1.26.11'.
You can disable this warning with: echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with: echo rvm_autoupdate_flag=2 >> ~/.rvmrc
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/osx/10.12/x86_64/ruby-2.1.6.tar.bz2
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
ruby-2.1.6 - #configure
ruby-2.1.6 - #download
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 7630k 100 7630k 0 0 1199k 0 0:00:06 0:00:06 --:--:-- 1551k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.6 - #validate archive
ruby-2.1.6 - #extract
ruby-2.1.6 - #validate binary
Libraries missing for ruby-2.1.6: cannot. Refer to your system manual for installing libraries
Mounting remote ruby failed with status 10, trying to compile.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Warning: DYLD_LIBRARY_PATH environment variable is set, this might interact with the compilation and ruby.
Installing Ruby from source to: /Users/davea/.rvm/rubies/ruby-2.1.6, this may take a while depending on your cpu(s)...
ruby-2.1.6 - #downloading ruby-2.1.6, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 11.4M 100 11.4M 0 0 2272k 0 0:00:05 0:00:05 --:--:-- 2354k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.6 - #extracting ruby-2.1.6 to /Users/davea/.rvm/src/ruby-2.1.6....
ruby-2.1.6 - #configuring....................................................
ruby-2.1.6 - #post-configuration.
ruby-2.1.6 - #compiling.......................................................................................................................................
ruby-2.1.6 - #installing...............
ruby-2.1.6 - #making binaries executable..
ruby-2.1.6 - #downloading rubygems-2.4.8
ruby-2.1.6 - #extracting rubygems-2.4.8.....
ruby-2.1.6 - #removing old rubygems.........
ruby-2.1.6 - #installing rubygems-2.4.8......................
ruby-2.1.6 - #gemset created /Users/davea/.rvm/gems/ruby-2.1.6#global
ruby-2.1.6 - #importing gemset /Users/davea/.rvm/gemsets/global.gems...............................................
ruby-2.1.6 - #generating global wrappers........
ruby-2.1.6 - #gemset created /Users/davea/.rvm/gems/ruby-2.1.6
ruby-2.1.6 - #importing gemsetfile /Users/davea/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.1.6 - #generating default wrappers........
ruby-2.1.6 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.1.6 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
localhost:lti_tool_provider_example-master davea$ bundle install
-bash: bundle: command not found
How do I restore the “bundle” command without interfering with the Ruby 2.1.3 version I just installed?

Bundle with Ruby 2.1.6
You just need to install bundler :
rvm use ruby-2.1.6
gem install bundler
This will be installed in a gemset specific to ruby-2.1.6, so it won't interfere with anything you installed with ruby-2.3.0. You can use
bundle install
to install the required gems.
Trying with Ruby 2.3.0
Alternatively, you could just try the example you downloaded with ruby-2.3.0 by either changing the
ruby '2.1.6'
line or deleting it from the Gemfile.

I experienced this same issue. For my case, the cause of the issue was because of two conflicting versions of the bundler gem that are very close in version number.
bundler (2.0.2, 2.0.1, default: 1.17.2)
The issue was from the bundler versions 2.0.2 and version 2.0.1
This is what I did to fix it.
Open your terminal or command line
Ctrl + Alt + T
N/B: The command above is for Linux Users, the one for Windows users might be different
Display a list of all your local gems for the bundler gem
gem list bundler
N/B: The command above is for rbenv version manager, the one for rvm might be different
Look through the displayed versions of the bundler gem, you will see some closely related conflicting versions like the one below
bundler (2.0.2, 2.0.1, default: 1.17.2)
Uninstall the bundler gem
gem uninstall bundler
Install a new copy of the bundler gem
gem install bundler
Try running the bundle install command again now
bundle install
That's all
I hope this helps.

Simply do the following
Open your terminal
Run gem uninstall bundler to uninstall previous versions of bundler
And then run gem install bundler to install a new copy of bundler
You can now run
bundle install
This worked for me

As mentioned above, you must re-install bundler gem again (because last one was and actually is attached to the previous version you had, as global library, you could actually go back and set it up as default again and see that bundler still there since usually all ruby versions you install thru version managers rbenv or rvm will be kept locally in your machine user's folder.
Step by step run the following (just in case)
rvm list known
Let's say ruby-2.3.3 is the latest or the one you want to work with
rvm install ruby-2.3.3
rvm use --default 2.3.3
gem install bundler
bundle install
In my case i was using OSX also rvm in OSX rvm store rubies in /Users/some_user/.rvm/rubies/default so just remember to configure whatever your terminal is with the proper rvm's ruby path in this case the file i should double check will be .bash_profile and the line of code i would look for will be export PATH=$PATH:/Users/some_user/.rvm/rubies/default
Hope this is helpful for someone that just realizes how rvm and rbenv work around, i was expecting somehow that bundler being a key part of the process will be more like a core library per se (ruby), but instead bundler is a totally separated gem, which bring me back to think, what a gem! way to go! inspirational one!

Related

rvm not installing ruby-2.2; Error running '__rvm_make -j4'

When I try to download Cocoapods, it says:
XXXX: ~ XXX$ sudo gem install cocoapods
Password:XX
ERROR: Error install cocoapods:
minitest requires Ruby version ~> 2.2.
Then I try every way to install ruby but it gives me this:
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/10.11/x86_64/ruby-2.2.5.tar.bz2
Checking requirements for osx.
Certificates bundle '/usr/local/etc/openssl#1.1/cert.pem' is already up to date.
Requirements installation successful.
ruby-2.2.5 - #configure
ruby-2.2.5 - #download
ruby-2.2.5 - #validate archive
ruby-2.2.5 - #extract
ruby-2.2.5 - #validate binary
Libraries missing for ruby-2.2.5: __rvm_ls. Refer to your system manual for installing libraries
Mounting remote ruby failed with status 10, trying to compile.
Checking requirements for osx.
Certificates bundle '/usr/local/etc/openssl#1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/vishaljayakumar/.rvm/rubies/ruby-2.2.5, this may take a while depending on your cpu(s)...
ruby-2.2.5 - #downloading ruby-2.2.5, this may take a while depending on your connection...
ruby-2.2.5 - #extracting ruby-2.2.5 to /Users/vishaljayakumar/.rvm/src/ruby-2.2.5.....
ruby-2.2.5 - #applying patch /Users/vishaljayakumar/.rvm/patches/ruby/2.2.5/fix_installing_bundled_gems.patch.
ruby-2.2.5 - #applying patch /Users/vishaljayakumar/.rvm/patches/ruby/2.2.5/openssl3.patch.
ruby-2.2.5 - #configuring......................................................-
ruby-2.2.5 - #post-configuration.
ruby-2.2.5 - #compiling........................................................|
Error running '__rvm_make -j4',
please read /Users/vishaljayakumar/.rvm/log/1581558007_ruby-2.2.5/make.log
There has been an error while running make. Halting the installation.
What do I do?
I have done literally every solution here and it doesn't work:
Github Error Page
Let me just name some of them just for you to see.
rvm get head
rvm mount -r https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.8.tar.bz2
rvm get stable; rvm reload; rvm install "ruby-2.2.X"
anything to do with openssl(I have no idea what it is)
rvm install ruby-2.6.5 --with-openssl-dir='{directory of openssl}
sudo xcode-select -s /Applications/Xcode.app
rvm install 2.6.4
brew install homebrew/portable-ruby/portable-openssl
rvm reinstall ruby-2.3.1 --with-openssl-dir=/usr/local/opt/portable-openssl/
Please give me a solution that is not in here(or one of the above).
I am a little desperate as I have wasted a lot of time on these commands!
I am free to any answers or comments!!!!!

Libraries missing for ruby 2.3.1

currently trying to install Ruby 2.3.1 using rvm on my terminal(macOS Sierra) but ran into this error
Libraries missing for ruby-2.3.1:
/Users/travis/.rvm/rubies/ruby-2.3.1/lib/libruby.2.3.0.dylib,/usr/local/opt/gdbm/lib/libgdbm.4.dylib. Refer to your system manual for installing libraries
This error is similar to another question on stack overflow but the solution there did not work for me.
I am new to Ruby, so any help would be much appreciated.
This is the full output from the terminal by the way.
ruby-2.3.1 - #removing src/ruby-2.3.1..
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/osx/10.12/x86_64/ruby-2.3.1.tar.bz2
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
ruby-2.3.1 - #configure
ruby-2.3.1 - #download
ruby-2.3.1 - #validate archive
ruby-2.3.1 - #extract
ruby-2.3.1 - #validate binary
Libraries missing for ruby-2.3.1: /Users/travis/.rvm/rubies/ruby-2.3.1/lib/libruby.2.3.0.dylib,/usr/local/opt/gdbm/lib/libgdbm.4.dylib. Refer to your system manual for installing libraries
Mounting remote ruby failed with status 10, trying to compile.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/sabrina.zuraimi/.rvm/rubies/ruby-2.3.1, this may take a while depending on your cpu(s)...
ruby-2.3.1 - #downloading ruby-2.3.1, this may take a while depending on your connection...
ruby-2.3.1 - #extracting ruby-2.3.1 to /Users/sabrina.zuraimi/.rvm/src/ruby-2.3.1....
ruby-2.3.1 - #configuring......................................................|
ruby-2.3.1 - #post-configuration.
ruby-2.3.1 - #compiling...........
Error running '__rvm_make -j 1',
showing last 15 lines of /Users/sabrina.zuraimi/.rvm/log/1481003831_ruby-2.3.1/make.log
compiling enc/utf_8.c
compiling enc/trans/newline.c
compiling ./missing/explicit_bzero.c
compiling ./missing/setproctitle.c
compiling dmyenc.c
linking miniruby
config.status: creating ruby-runner.c
generating encdb.h
encdb.h updated
rbconfig.rb updated
generating enc.mk
making srcs under enc
/bin/sh: /Applications/Xcode-beta: No such file or directory
make: *** [srcs-enc] Error 127
++ return 2
I have the same error but the installation completes successfully.
Napuka:~ joaquin$ rvm install ruby-2.3.3
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.12/x86_64/ruby-2.3.3.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/joaquin/.rvm/rubies/ruby-2.3.3, this may take a while depending on your cpu(s)...
ruby-2.3.3 - #downloading ruby-2.3.3, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13.7M 100 13.7M 0 0 2219k 0 0:00:06 0:00:06 --:--:-- 2220k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.3.3 - #extracting ruby-2.3.3 to /Users/joaquin/.rvm/src/ruby-2.3.3....
ruby-2.3.3 - #configuring......................................................|
ruby-2.3.3 - #post-configuration.
ruby-2.3.3 - #compiling........................................................-
ruby-2.3.3 - #installing.........
ruby-2.3.3 - #making binaries executable..
Installed rubygems 2.5.2 is newer than 2.4.8 provided with installed ruby, skipping installation, use --force to force installation.
ruby-2.3.3 - #gemset created /Users/joaquin/.rvm/gems/ruby-2.3.3#global
ruby-2.3.3 - #importing gemset /Users/joaquin/.rvm/gemsets/global.gems.........|
ruby-2.3.3 - #generating global wrappers........
ruby-2.3.3 - #gemset created /Users/joaquin/.rvm/gems/ruby-2.3.3
ruby-2.3.3 - #importing gemsetfile /Users/joaquin/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.3.3 - #generating default wrappers........
ruby-2.3.3 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.3.3 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
But your message looks quite explicit:
/bin/sh: /Applications/Xcode-beta: No such file or directory
Do you have that directory?
First of all, do you have Xcode installed? If not, you can just get the command line tools here: http://railsapps.github.io/xcode-command-line-tools.html
It seems like the message is saying that you had Xcode-beta but removed it and now it has no way to install properly. The command line tools should be good enough

Ruby issue when installing Umpire on Ubuntu 12.04

I am currently trying to get https://github.com/heroku/umpire working locally on my Ubuntu machine with graphite.
I have done the following steps on version 12.04 of Ubuntu:
git clone https://github.com/heroku/umpire
cd umpire
sudo apt-get install ruby-rvm
sudo rvm install ruby-1.9.2-p180
sudo apt-get install ruby-bundler
The line that is producing the error in the Gemfile:
gem 'rack-timeout', git: "https://github.com/freeformz/rack-timeout.git"
This is the error that I am getting in the terminal:
/home/vagrant/umpire/Gemfile:9:in `evaluate': compile error (SyntaxError)
/home/vagrant/umpire/Gemfile:9: syntax error, unexpected ':', expecting $end
gem 'rack-timeout', git: "https://github.com/freeformz...
^
from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:17:in `build'
from /usr/lib/ruby/vendor_ruby/bundler.rb:136:in `definition'
I've been trying to fix this for a while but I am not particularly familiar with Ruby. Does anyone know how fix this?
Thank you in advance for any help.
I would not use the apt provided rvm. It's old and broken in a few ways AFAICT.
Start here: Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v
Once I did that I was able to install the right version of ruby for my user and bundle install...
vagrant#ubuntu-12:~$ cd umpire/
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /home/vagrant/umpire/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.
ruby-1.9.3-p547 is not installed.
To install do: 'rvm install ruby-1.9.3-p547'
vagrant#ubuntu-12:~/umpire$ rvm install ruby-1.9.3-p547
Searching for binary rubies, this might take some time.
Found remote file https://rvm.io/binaries/ubuntu/12.04/x86_64/ruby-1.9.3-p547.tar.bz2
Checking requirements for ubuntu.
Requirements installation successful.
ruby-1.9.3-p547 - #configure
ruby-1.9.3-p547 - #download
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 11.3M 100 11.3M 0 0 1851k 0 0:00:06 0:00:06 --:--:-- 2137k
ruby-1.9.3-p547 - #validate archive
ruby-1.9.3-p547 - #extract
ruby-1.9.3-p547 - #validate binary
ruby-1.9.3-p547 - #setup
ruby-1.9.3-p547 - #gemset created /home/vagrant/.rvm/gems/ruby-1.9.3-p547#global
ruby-1.9.3-p547 - #importing gemset /home/vagrant/.rvm/gemsets/global.gems....................................
ruby-1.9.3-p547 - #generating global wrappers........
ruby-1.9.3-p547 - #gemset created /home/vagrant/.rvm/gems/ruby-1.9.3-p547
ruby-1.9.3-p547 - #importing gemsetfile /home/vagrant/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-1.9.3-p547 - #generating default wrappers........
vagrant#ubuntu-12:~/umpire$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching https://github.com/freeformz/rack-timeout.git
Installing rake 10.1.1
Installing addressable 2.3.5
Installing aggregate 0.2.2
Installing safe_yaml 0.9.7
Installing crack 0.4.1
Installing diff-lcs 1.2.5
Installing excon 0.31.0
Installing multipart-post 1.2.0
Installing faraday 0.8.9
Installing multi_json 1.8.4
Installing librato-metrics 1.3.0
Installing rack 1.5.2
Installing puma 2.7.1
Installing rack-protection 1.5.1
Installing rack-ssl 1.3.3
Installing rack-test 0.6.2
Using rack-timeout 0.1.0beta2 from https://github.com/freeformz/rack-timeout.git (at master)
Installing rspec-core 2.14.7
Installing rspec-expectations 2.14.4
Installing rspec-mocks 2.14.4
Installing rspec 2.14.1
Installing scrolls 0.3.3
Installing tilt 1.4.1
Installing sinatra 1.4.4
Installing webmock 1.16.1
Installing yajl-ruby 1.2.0
Using bundler 1.6.2
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
vagrant#ubuntu-12:~/umpire$

installing ruby 2.0.0 through RVM

I am on Macbook Air (v. 10.8.4) and am trying to install ruby 2.0.0. I did rvm get stable then rvm install ruby-2.0.0. I get this error...
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.0.0-p247, this may take a while depending on your cpu(s)...
ruby-2.0.0-p247 - #downloading ruby-2.0.0-p247, this may take a while depending on your connection...
ruby-2.0.0-p247 - #extracted to /usr/local/rvm/src/ruby-2.0.0-p247 (already extracted)
ruby-2.0.0-p247 - #configuring - using Zsh, can not show progress, be patient...
ruby-2.0.0-p247 - #compiling - using Zsh, can not show progress, be patient...
Error running 'make -j4',
please read /usr/local/rvm/log/ruby-2.0.0-p247/1373658495_make.log
There has been an error while running make. Halting the installation.
I tried Can't install Ruby 2.0.0-p0 with RVM. Error running 'make -j8' but I am still getting the same error. As in, I tried
I copied and pasted the log file into a google doc because it was 400+ lines. Link here https://docs.google.com/document/d/1mwiL88KbWYfFge3XKQF2hOJjG_8PzYTdcRFxbZcpUeU/edit?usp=sharing
try running these commands in given sequence: ---
brew update
brew tap homebrew/dupes
brew install apple-gcc42
rvm get stable
rvm install ruby-2.0.0

ruby gems under rvm on Ubuntu (failing to) install in the wrong location

I'm running Ubuntu 10.04 and originally installed ruby 1.9.1 (from source). I've just decided to try out ruby 1.9.2 and rails 3, and it seemed like a good time to use rvm to deal with the multiple ruby installs and gemsets.
rvm installed and seems to be working, I installed ruby 1.9.2 in rvm and made that my default ruby. However, every time I try to install a gem under ruby 1.9.2 I see this error.
mark#Steve-Austins-Penguin:~$ gem install haml
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /home/mark/.gem/specs
gem environment returns:
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/mark/.rvm/gems/ruby-1.9.2-p0
- RUBY EXECUTABLE: /home/mark/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
- EXECUTABLE DIRECTORY: /home/mark/.rvm/gems/ruby-1.9.2-p0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/mark/.rvm/gems/ruby-1.9.2-p0
- /home/mark/.rvm/gems/ruby-1.9.2-p0#global
<snip>
But if the correct installation, ruby and gem paths are showing here why is ruby trying to install gems to /home/mark/.gem? All the variables and paths shown by env look right, and I can't find a .gemrc file anywhere on my system that might contain conflicting path settings.
So I guess my question is what might be causing rubygems to attempt to install to /home/mark/.gems instead of the correct paths set by rvm?
In response to the question below:
mark#Steve-Austins-Penguin:~$ echo $PATH
/home/mark/.rvm/gems/ruby-1.9.2-p0/bin:/home/mark/.rvm/gems/ruby-1.9.2-p0#global/bin:/home/mark/.rvm/rubies/ruby-1.9.2-p0/bin:/home/mark/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
mark#Steve-Austins-Penguin:~$ which gem
/home/mark/.rvm/rubies/ruby-1.9.2-p0/bin/gem
mark#Steve-Austins-Penguin:~$ rvm list
rvm rubies
ruby-1.8.7-p302 [ x86_64 ]
=> ruby-1.9.2-p0 [ x86_64 ]
mark#Steve-Austins-Penguin:~$ env
rvm_gemsets_path=/home/mark/.rvm/gemsets
MANPATH=:/home/mark/.rvm/man
rvm_scripts_path=/home/mark/.rvm/scripts
rvm_bin_path=/home/mark/.rvm/bin
GEM_HOME=/home/mark/.rvm/gems/ruby-1.9.2-p0
rvm_patchsets_path=/home/mark/.rvm/patchsets
SHELL=/bin/bash
IRBRC=/home/mark/.rvm/rubies/ruby-1.9.2-p0/.irbrc
rvm_patches_path=/home/mark/.rvm/patches
MY_RUBY_HOME=/home/mark/.rvm/rubies/ruby-1.9.2-p0
rvm_selfcontained=1
USER=mark
__shell_array_start=0
rvm_gems_cache_path=/home/mark/.rvm/gems/cache
rvm_config_path=/home/mark/.rvm/config
rvm_path=/home/mark/.rvm
USERNAME=mark
rvm_gemset_separator=#
rvm_ruby_args=
rvm_rubies_path=/home/mark/.rvm/rubies
PWD=/home/mark
rvm_hooks_path=/home/mark/.rvm/hooks
rvm_version=1.0.1
rvm_src_path=/home/mark/.rvm/src
HOME=/home/mark
rvm_gems_path=/home/mark/.rvm/gems
rvm_ruby_string=ruby-1.9.2-p0
BUNDLE_PATH=/home/mark/.rvm/gems/ruby-1.9.2-p0
rvm_tmp_path=/home/mark/.rvm/tmp
LOGNAME=mark
GEM_PATH=/home/mark/.rvm/gems/ruby-1.9.2-p0:/home/mark/.rvm/gems/ruby-1.9.2-p0#global
rvm_action=list
rvm_log_path=/home/mark/.rvm/log
rvm_interactive=1
RUBY_VERSION=ruby-1.9.2-p0
rvm_archives_path=/home/mark/.rvm/archives
rvm_repo_path=/home/mark/.rvm/repos
_=/usr/bin/env
Note that I've edited down the response from env slightly - simply to keep the size of this post under control - by removing all the entries relating to X, GNOME and SSH.
Following up the backtrace from running gem install -V --backtrace --debug haml (thanks zzzhc) and taking a closer look at the /home/mark/.gem directory I found that there were no gems installed there, just gemspec files and gem source files. In the spirit of experimentation I deleted /home/mark/.gem and re ran the gem install command and suddenly it was working. And that it had recreated /home/mark/.gem containing gemspecs for the gems I'd just installed.
It's clear now that I'd misinterpreted the error message in the original question; rubygems didn't fail while trying to install gems to /home/mark/.gem, it was simply using that directory as a temporary store for the gemspecs of newly downloaded gems about to be installed. Before installing rvm I'd been installing gems onto the system using sudo gem install... which would have created the /home/mark/.gem directory with root permissions. So rubygems run without sudo was unable to access the temp directory to store gemspecs in and was aborting before it could install the gems. Doh!
Another way is type which gem after getting into the ruby version. You will get something like this - /home/username/.rvm/rubies/ruby-1.9.2-p180/bin/gem. Now just type sudo /home/username/.rvm/rubies/ruby-1.9.2-p180/bin/gem install gem_name.
Specifying the complete path and adding sudo work fine.
check the first line of /home/mark/.rvm/rubies/ruby-1.9.2-p0/bin/gem and look at http://yehudakatz.com/2010/08/24/a-tale-of-abort-traps-or-always-question-your-assumptions/

Resources