Search code examples
rubysassguard

Guard runs in Terminal but not iTerm2


When I try to run guard in iTerm2, I get the following output. (It runs fine in Terminal.)

/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find guard (>= 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)
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/guard:18:in `<main>'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
    from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'

Some other details: I'm using oh-my-zsh with iTerm2. I'm also using oh-my-zsh with Terminal, where I have no issues.

This is not a Rails app. It's just a directory with a Guardfile used for Guard Sass.


Solution

  • Figured out what the problem was. It was because I was not running iTerm2 as a login shell.

    I went to iTerm2 Preferences -> Profiles Tab. Under Command I selected the option for Login shell, instead of the option for Command.

    Restarted iTerm2. Guard runs without errors.