Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switching over to zsh breaks rails in command line

I just recently switched over to using zsh with oh-my-zsh and I am having issues using the rails command line tool. Here are the steps that I ran through, and the error that I am receiving.

I ran the curl command that the github page provides:

curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh

Then I went to run rails s, this is the following error message that I receive:

.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)

This looks like I am having a gem error so I reinstalled rvm, rails and bundler with nothing solving the issue. However if I switch my terminal back over to bash then I dont have any issues and rails works perfectly fine. Has anyone else run into a similar issue? I want to use zsh because it seems like it has better features but if I can't use rails then I have to dump it to the curb.

These are the lines at the end of my .zshrc file:

export PATH=/Users/thomascioppettini/.rvm/gems/ruby-1.9.3p0/bin:/Users/thomascioppettini/.rvm/gems/ruby-1.9.3-p0@global/bin:/Users/thomascioppettini/.rvm/rubies/ruby-1.9.3-p0/bin:/Users/thomascioppettini/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
like image 678
tomciopp Avatar asked Mar 05 '12 12:03

tomciopp


2 Answers

What I have done to work bundle zsh and rvm, that is couple of body movies:

1) add to .zshrc at first line to correct find bin direcrory (your CO):

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

2) add next line after previous one:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

3) and at the end change PATH:

export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

For me it is work fine (now it correct define $PATH with all rvm gemsets)

like image 104
mart7ini Avatar answered Oct 27 '22 01:10

mart7ini


did you put the

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

into your .zshrc?

I assume the rvm-installer installs it only into .bashrc

like image 36
fenton Avatar answered Oct 27 '22 00:10

fenton