command not found: complete
Asked Answered
M

7

20

I have a fresh mac in front of me, I installed homebrew (just fine), and oh my zsh (just fine).

I'm trying to install autojump which is a intelligent database of directories. For example, you can 'jump' to ~/Documents with j doc in terminal.

I did this

brew install autojump

I already have my .zshrc that looks fine I think. I added the line into it that it said:

[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh

When I start iterm2 I get the following warning:

/usr/local/Cellar/autojump/21.3.0/etc/autojump.bash:13: command not found: complete
/usr/local/Cellar/autojump/21.3.0/etc/autojump.bash:55: = not found

I have used brew to install other things, and I can run autojump -s successfully so I know it is seeing the $path. I don't know what else could be wrong though, as this is all a fresh install.

Mirtamirth answered 18/1, 2013 at 23:43 Comment(0)
S
9

In your .zshrc, you must source autojump.zsh, not autojump.bash (I do not know where it will be located on a Mac, but it will be in same folder as autojump.bash).

On Ubuntu, here is what you need to append at the end of your .zshrc:

source /usr/share/autojump/autojump.zsh
Shrew answered 29/3, 2013 at 11:15 Comment(0)
S
5

To fix the problem, you should update the line:

[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh

to say:

[[ -s `brew --prefix`/etc/autojump.zsh ]] && . `brew --prefix`/etc/autojump.zsh

i.e. use the .zsh version of the autojump script. That fixed it for me.

Sakhuja answered 29/1, 2014 at 23:8 Comment(0)
N
2

That file has no Shebang. This means that it is probably getting interpreted by Zsh.

This is a problem because complete is a Bash builtin.

Perhaps this can be a fix for you, or maybe

[[ -s `brew --prefix`/etc/autojump.sh ]] && bash `brew --prefix`/etc/autojump.sh
Nerty answered 18/1, 2013 at 23:51 Comment(1)
So I just add it manually? I just looked at another machine I have this running on and I don't have a shebang. My .bashrc, .bash_profile, .zshrc all match. So weird..Mirtamirth
P
2

In my case, I solve this issue adding :

autoload bashcompinit && bashcompinit

Before the first complete command.

I've used this link : Fixed! az.completion:10: command not found: complete

Pavkovic answered 8/11, 2021 at 22:21 Comment(0)
W
1

In my case, comment out

[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

solved the issue.

Wilt answered 30/7, 2020 at 2:7 Comment(0)
H
1

If you are mac user using .zsh

just add the following to your .zsrc file

autoload -U +X bashcompinit && bashcompinit
autoload -U +X compinit && compinit

for more info refer to link : https://github.com/eddiezane/lunchy/issues/57

Honewort answered 1/9, 2022 at 21:47 Comment(0)
E
0

You need to add

[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh

to your ~/.bash_profile. Homebrew tells you this when you install but I didn't notice it the first time and came to this webpage as a result.

Endorsed answered 19/9, 2013 at 12:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.