1

OS X 10.11.5. I'm new to OS X and Ruby. I used homebrew to install chruby and ruby-install, then used these to install Ruby and Rails. Later I installed RubyMine. I like it, but it does not support chruby. I want to uninstall chruby and ruby-install and use RVM. On a different iMac I installed rvm and RubyMine and everything works fine. Now I want to clean up my iMac to install rvm.

The main thing I don't understand is how my set output has things like these:

GEM_PATH=/Users/mark/.gem/ruby/2.3.1:/Users/mark/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0
GEM_ROOT=/Users/mark/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0
...
RUBY_ROOT=/Users/mark/.rubies/ruby-2.3.1
RUBY_VERSION=2.3.1
...
chruby_reset () 
{ 
    [[ -z "$RUBY_ROOT" ]] && return;  
    PATH=":$PATH:";
PATH="${PATH//:$RUBY_ROOT\/bin:/:}";
if (( $UID != 0 )); then
    [[ -n "$GEM_HOME" ]] && PATH="${PATH//:$GEM_HOME\/bin:/:}";
    [[ -n "$GEM_ROOT" ]] && PATH="${PATH//:$GEM_ROOT\/bin:/:}";
    GEM_PATH=":$GEM_PATH:";
    [[ -n "$GEM_HOME" ]] && GEM_PATH="${GEM_PATH//:$GEM_HOME:/:}";
    [[ -n "$GEM_ROOT" ]] && GEM_PATH="${GEM_PATH//:$GEM_ROOT:/:}";
    GEM_PATH="${GEM_PATH#:}";
    GEM_PATH="${GEM_PATH%:}";
    unset GEM_ROOT GEM_HOME;
    [[ -z "$GEM_PATH" ]] && unset GEM_PATH;
fi;
PATH="${PATH#:}";
PATH="${PATH%:}";
unset RUBY_ROOT RUBY_ENGINE RUBY_VERSION RUBYOPT;
hash -r
}
...

I've looked in the places man bash says to look, /etc/bashrc, /etc/profile, ~/.bash_profile and ~/.bashrc, but I have not figured out how GEM_PATH gets put in my bash shell.

1
  • have you tried just grepping for GEM_PATH in your homdir and root if necessary (e.g. grep -Rni 'GEM_PATH' / 2>/dev/null to avoid not-access err msg)? May 29 '16 at 20:53
0

I know there must be better ways, but I had been unproductive too long. I decided to "rename to uninstall", check everything carefully, then install Homebrew as if it was fresh. I could not rename /usr/local, but I was able to rename everything inside it. Several restarts later, RVM is installed and RubyMine is working! My /usr/local looks like this.

...
drwxr-xr-x  24 mark  admin   816 May 29 16:06 bin/
drwxr-xr-x  92 mark  admin  3128 May 19 18:21 bin_old/
drwxr-xr-x   4 mark  admin   136 May 29 16:06 etc/
drwxr-xr-x   4 mark  admin   136 May 10 15:52 etc_old/
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.