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.

Yuma Inaura
  • 199
  • 1
  • 1
  • 6
  • What's the output of `echo $PATH`? Did you install any plugin? – Thomas Ayoub May 11 '16 at 06: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` – Yuma Inaura May 11 '16 at 06:59
  • Next time when adding info, [edit] your question ;) – Thomas Ayoub May 11 '16 at 07:50
  • 1
    Ask on https://apple.stackexchange.com – trojanfoe May 11 '16 at 09:21

6 Answers6

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.

Picard
  • 3,745
  • 3
  • 41
  • 50
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

Sumit Kapoor
  • 1,089
  • 12
  • 10
4

Just in case it can helps someone :

sudo chmod -R 755 /usr/local/share/zsh/site-functions
Pierre Gerbaud
  • 131
  • 1
  • 5
4

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

CT4nk3r
  • 49
  • 5
1

Some issue with zsh update causing this issue.

Just using source ~/.zshrc worked for me.

Meet Shah
  • 99
  • 8
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
George Smith
  • 438
  • 4
  • 8