17

On macbook terminal, when i hit the command TAB key after ls. Terminal say error.

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

This example is ls, but other all command has same trouble. I rebooted mac but trouble has not cleared.

What's happen do you know?


Mac was shutdown by himself automatically, and repaired before i knew it.

OS is: OS X El Capitan.

4
  • What's the output of echo $PATH? Did you install any plugin? May 11, 2016 at 6:56
  • Thanks Thomas, this is. umm i must remember libraries i installed today and check them. $ echo $PATH /Users/yinaura/.gem/ruby/2.0.0/bin:/Users/yinaura/google-cloud-sdk/bin:/Users/yinaura/.rbenv/shims:/Users/yinaura/.rbenv/bin:./vendor/bin:/Users/yinaura/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin May 11, 2016 at 6:59
  • Next time when adding info, edit your question ;) May 11, 2016 at 7:50
  • 1
    Ask on apple.stackexchange.com
    – trojanfoe
    May 11, 2016 at 9:21

6 Answers 6

30

It's probably oh-my-zsh reporting insecure directory permissions.

Running compaudit in the terminal will show you those dirs. In my case it was:

/usr/local/share/zsh/
/usr/local/share/zsh/site-functions

I my case removing group write permissions like this:

chmod g-w /usr/local/share/zsh/
chmod g-w /usr/local/share/zsh/site-functions

helped.

Or do just:

compaudit | xargs chmod g-w

as my shell suggests. (MacOS 11.2.1)

Check also this answer.

0
18

It might be because of zsh setup not done correctly. I also ran into the same issue this is how I fixed it. I ran the below command and the issue got fixed. I am not sure what was the actual issue but yeah running this command worked for me.

exec zsh

2
  • 1
    Worked for me too, no idea why the error was happening nor why it fixed.
    – henrique
    Jul 8, 2021 at 13:26
  • This worked for me also. Thank you. Wish I knew the root cause however.
    – Del
    Mar 29 at 19:37
4

Just in case it can helps someone :

sudo chmod -R 755 /usr/local/share/zsh/site-functions
4

For me doing source .zshrc was able to solve this problem.

1

Some issue with zsh update causing this issue.

Just using source ~/.zshrc worked for me.

0

I experience this problem after installing Homebrew on my new macOS Ventura (13) M1 Max (Mac Studio)

Step1

compaudit

Output: There are insecure directories: /opt/homebrew/share

Step 2

Either execute:

compaudit | xargs chmod g-w

The command will still give you "There are insecure directories:", but with an empty list (no directories will be listed)

OR

chmod g-w /opt/homebrew/share

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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