Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

why does zsh ask to correct rspec to spec when running bundler?

✗ rspec --version
✗ bundle exec rspec --version
zsh: correct 'rspec' to 'spec' [nyae]? n


  • ubuntu 12.10
  • using rvm

how do I fix this? Thanks!


hitting ctrl-x h on bundle exec as asked by @mpy

 ✗ bundle exec
tags in context :completion::complete:bundle::
    all-files  (_files _default (eval))


[[ -o correctall ]] && echo enabled
enabled   # on both machines

Answer to comment: spec is a directory

I followed the Manual Installation from https://github.com/zsh-users/zsh-completions

✗ echo $fpath
/home/ole/app/zsh-completions/src /scripts/zsh/Completion /home/ole/.oh-my-zsh/plugins/ruby /home/ole/.oh-my-zsh/plugins/bundler /home/ole/.oh-my-zsh/plugins/zeus /home/ole/.oh-my-zsh/plugins/rvm /home/ole/.oh-my-zsh/plugins/rails3 /home/ole/.oh-my-zsh/plugins/git-extras /home/ole/.oh-my-zsh/plugins/git-flow /home/ole/.oh-my-zsh/plugins/git /home/ole/.oh-my-zsh/functions /home/ole/.oh-my-zsh/completions /usr/local/share/zsh/site-functions /usr/share/zsh/vendor-functions /usr/share/zsh/vendor-completions /usr/share/zsh/functions/Calendar /usr/share/zsh/functions/Chpwd /usr/share/zsh/functions/Completion /usr/share/zsh/functions/Completion/AIX /usr/share/zsh/functions/Completion/BSD /usr/share/zsh/functions/Completion/Base /usr/share/zsh/functions/Completion/Cygwin /usr/share/zsh/functions/Completion/Darwin /usr/share/zsh/functions/Completion/Debian /usr/share/zsh/functions/Completion/Linux /usr/share/zsh/functions/Completion/Mandriva /usr/share/zsh/functions/Completion/Redhat /usr/share/zsh/functions/Completion/Solaris /usr/share/zsh/functions/Completion/Unix /usr/share/zsh/functions/Completion/X /usr/share/zsh/functions/Completion/Zsh /usr/share/zsh/functions/Completion/openSUSE /usr/share/zsh/functions/Exceptions /usr/share/zsh/functions/MIME /usr/share/zsh/functions/Misc /usr/share/zsh/functions/Newuser /usr/share/zsh/functions/Prompts /usr/share/zsh/functions/TCP /usr/share/zsh/functions/VCS_Info /usr/share/zsh/functions/VCS_Info/Backends /usr/share/zsh/functions/Zftp /usr/share/zsh/functions/Zle

$fpath changed. It had no effect.

excerpt from my .zshrc

# Path to your oh-my-zsh configuration.

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)

plugins=(git git-flow git-extras rails3 rvm zeus bundler ruby)

source $ZSH/oh-my-zsh.sh   

# Customize to your needs...
export PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function

export JAVA_HOME=$HOME/app/jdk1.7.0_15

fpath=($HOME/app/zsh-completions/src $fpath)

my changes wore

- plugins=(git rails ruby)
+ plugins=(git git-flow git-extras rails3 rvm zeus bundler ruby)

+ fpath=($HOME/app/zsh-completions/src $fpath)

and this had no effect. The error persist (I open a new terminal tab each time)

share|improve this question
The interesting part is, that zsh won't correct rspec alone. So I suspect, that it's assumed in the second example that rspec should be a option or something to the bundle command, meaning that the bundle completer must be enhancd. I don't have bundle, so can you post the output of the following procedure: input bundle exec and then press C-x h? –  mpy Mar 6 '13 at 9:27
@mpy updated my answer. does it help you? As an FYI, bundle exec is meant to solve the problem of multiple installed executable. One project may use rspec 1.10, another rspec 2.12.2. bundle reads the project local Gemfile to see the version and execute the correct rspec executable. So rspec is a program, not just a parameter. I don't have this problem on my Mac running zsh, only on this ubuntu install. –  oma Mar 6 '13 at 11:08
Yeah helps, as it shows that zsh does not know that after bundle exec a command should be issued. But it's probably easier than I thought (because I mixed up "correction" with "approximate completion"), especially that you write it works on another machine. So please try if there's a difference between the both machines for [[ -o correctall ]] && echo enabled. correctall also tries to correct any arguments as files. Do you have a file spec in the current dir? –  mpy Mar 6 '13 at 11:50
For a completion function for bundle, have a look at github.com/zsh-users/zsh-completions/blob/master/src/_bundle. Simply put that into /usr/share/zsh/site-functions or another folder with is included in $fpath -- as it seems that's _bundledoes not ship with zsh by default. –  mpy Mar 6 '13 at 11:53
@mpy please make an answer out of this with a bit more detail (and I can upvote), I'm not enterly following you. To your Qs: 1. correctall is enabled on both 2. specis a folder, i normally run bundle exec rspec spec. –  oma Mar 7 '13 at 10:25

2 Answers 2

Because it thinks rspec is a misspelling of spec?

  • You can use nocorrect (e.g. alias bundle='nocorrect bundle'),
  • or just stop using command line correction altogether.
  • or use CORRECT instead of CORRECT_ALL which is what you seem to be using

[edit] Notice zsh is using the completer functions to determine what to expect. In the secnd case it is using the completer for bundle

share|improve this answer
no, zsh doesn't consider it a misspelling, see first line. It does so however, in context of bundle exec. Why? - that's the question. –  oma Mar 6 '13 at 10:23
AFAIK zsh uses the completion options for whitelisting spellings. In the first case, it uses the completer for rspec, in the second it is using (see the question updates) the completer for bundle. –  Francisco Mar 7 '13 at 13:13
This worked perfectly for me. –  Jacob Dalton Mar 13 '13 at 1:37
This is the solution that worked for me as well. Unless there is a solution to specifically isolate rspec when used in bundle exec I think this should be the accepted answer. –  roloenusa Mar 5 at 19:22

Automatic spell checking can be actived in two ways (I use "From bash to Z Shell" by O. Kiddle et al. as a guide/reference):

  • setopt correct

    After pressing Enter zsh "looks at the command word, and if doesn't recognize it as a command it tries to find a correction, which then offers to you."

  • setopt correctall

    Like correct, but in addition checks the "arguments after the command. However, it simply assumens they are files, and tries to correct the words to filenames. Often isn't what you want."

So, the latter explains, why you get spec offered as correction for rspec -- zsh thinks that should be a file (or in your case a directory). It does not explain, why it's working on the other machine. (I suppose some different setup in both your personal or global config files (~/.zshrc or /etc/zsh/), less likely a version issue.)

[Closely related to this rather simple spell checking is a feature of the completion system, called "approximate completion". The completion system is zsh is very advanced an is worth a study of its own.(*) As I don't use that "approximate completion" myself I want to direct you to man zshcompsys, Section "CONTROL FUNCTIONS" _approximate. if you are interested.]

But, unless you have special reasons for that, I would use unsetopt correctall && setopt correct to get rid of the described behavior (that's the last point proposed by Francisco) and use a decent completion function for `bundle (that's my last comment).

With the aid of completion fucntions zsh gets rather "smart". So it knows for example that after sudo a command must follow, hence sudo passTAB will complete to sudo passwd. You use bundle, for which there's also a completion function, but obviously not shipped by default.(**) With that you will get a nice reminder of bundle's options:

$ bundle -TAB-
check     -- Determine whether the requirements for your application are installed
config    -- Specify and read configuration options for bundler
console   -- Start an IRB session in the context of the current bundle
exec      -- Execute a script in the context of the current bundle
gem       -- Create a simple gem, suitable for development with bundler

and after typing bundle exec you'll get only commands presented. I prefer that behavior much more than correction, but it's up to you.

(*) It's activated by autoload -U compinit && compinit. To check if it's active (it probably is), use which compinit:

$ zsh -f

$ which compinit
compinit not found

$ autoload -U compinit

$ which compinit
compinit () {
# undefined
builtin autoload -XU

(**) Copy https://github.com/zsh-users/zsh-completions/blob/master/src/_bundle to a directory which is in your $fpath

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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