zsh: command not found: j #196

shepherdwind opened this Issue Mar 22, 2013 · 10 comments


None yet
7 participants

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.


spinningarrow commented Mar 23, 2013

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

spinningarrow commented Mar 24, 2013

Try adding this to your .zshrc:

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

sloria commented Apr 2, 2013

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.


wting commented May 14, 2013

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.

maxwerr commented Sep 29, 2014

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.

iClosedz commented Oct 4, 2014

Got the same problem with maxwerr.


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.


wting commented Nov 17, 2014

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment