Mac command line say "bad math expression: operand expected at end of string"

Previously asks the question however the solution of restarting my computer has not worked.. I was hoping someone might be able to help me debug or provide an understanding as to what is going on and how to resolve.. this is super dev ops for me unfortunately..

_complete:96: bad math expression: operand expected at end of string

Is the error message whereby this occurs on tab hits and sometimes even cd, ls 's kind of commands.. originally used iTerm but thought issue might be isolated to this software however is occurring in terminal as well..

I recently ran brew upgrade and reinstalled yarn and as a result had to reinstall sass gems.. so I'm not sure but if I had to bet it's something to do with that..

Ask requested in the above linked answer below is my $PATH:

➜ luckyme-scrollmagic git:(jimmy) echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

I don't understand what any of this means unfortunately..

Any help or guidance on how to solve would be gr8ly appreciated


  • 1
    For me this happened after installing nvm. I manually commented out code to load bash_completion in my ,zshrc for now
    – Kazuki
    Commented Apr 18, 2020 at 5:27

1 Answer 1


A basic shell error message consists of a comand, a colon, a operand/filename, a colon, and a message, like

command: operand/filename: error message

as an example

ls foo
ls: foo: No such file or directory

These error message may contain multiple commands and/or error messages, as an example

ls | fake_command
-ksh: fake_command: not found

and without a operand/filename. But they are usually not that difficult to digest. In your case, your shell completions are producing the error message.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .