Autojump: zsh: command not found: j

Created on 22 Mar 2013  ·  11Comments  ·  Source: wting/autojump

I install autojump by brew, run command

$ brew install autojump

But, there are some problem with me. First, I can only run the command autojump, the j is not found when I run it. Then, I run autojump -a ~/code, return error message:

  File "/usr/local/bin/autojump", line 176, in save
    temp = NamedTemporaryFile(dir = CONFIG_DIR, delete = False)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 447, in NamedTemporaryFile
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 228, in _mkstemp_inner
    fd = _os.open(file, flags, 0600)
OSError: [Errno 2] No such file or directory: '/Users/eward/.local/share/autojump/tmprYDreK

/Users/eward is my home dir. I think the problem is the tmp file is not writeable, So I create the dir ~/.local/share/autojump for autojump. Now, the autojump --add is ok, but j is not available.

Then from issue #178 I find out that, my .zshrc should include the etc file of autojump, And I add it to my .zshrc file

source $HOME/homebrew/Cellar/autojump/21.1.2/etc/autojump.zsh

Final, autojump is work, but, I do not know, if so much trouble is because of what. May be, there is a bug, or may someone face the same problem with me. I hope this can helpful.

needs-info os-mac shell-zsh

Most helpful comment

Try adding this to your .zshrc:

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

All 11 comments

Is zsh your default shell? I had a problem where autojump wouldn't work properly because bash was my default shell but I was using zsh. What do you get when you run echo $SHELL?

yes, zsh is default shell.

$ echo $SHELL
/bin/zsh

Try adding this to your .zshrc:

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

Having the same problem. Strangely, I have changed my default shell using chsh -s /bin/zsh which successfully logs me into a new zsh session when I open Terminal, but when I run echo $SHELL it shows /bin/bash.

The Homebrew formula was updated recently, can you guys reinstall and see if you're having the same problems?

Reinstall is fine, no problem, thanks.

I'm actually having this issue as well... zsh is default, 'autojump' works whereas 'j' is not found. Just updated and installed to no avail. .zshrc add-in results in:
autojump: directory '' not found
Try autojump --help for more information.

Got the same problem with maxwerr.

/bin/zsh

and I add this on my .zshrc:

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

when call j:

autojump: directory '' not found
Try `autojump --help` for more information.

I've had autojump for a long time and it has always worked fine. I just did a huge update of all homebrew stuff and it broke in the way that is being described above. I dug into the \brew --prefix/etc/to find that instead of a generic executable (autojump), there are now executables for each type of shell (autojump.sh,autojump.zsh,autojump.fish,autojump.bash). Once I updated the setup line in my .zshrc file (as others have mentioned above), it worked great:

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

The trick was to use the zsh one since I am using zsh as my default shell. I realize this issue is closed, but hopefully that helps anyone who comes across this issue.

Just to clarify there has always been multiple wrapper shell files (autojump.bash, autojump.zsh, etc). However autojump.sh is supposed to be intelligently figure out which shell you're actually using and load the right file.

@jbranchaud: The behavior of autojump.sh has changed relatively recently. If you're unable to load correctly with autojump.sh, could you open a ticket with the version of autojump you're using?

Try adding this to your .zshrc:

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

this one solved it for me. Mojave, zsh 5.3, autojump 22.5.3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

srid picture srid  ·  14Comments

shanyutou picture shanyutou  ·  3Comments

rsparkyc picture rsparkyc  ·  11Comments

hcsaustrup picture hcsaustrup  ·  9Comments

mbigras picture mbigras  ·  3Comments