Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zsh: command not found: j #196

Closed
shepherdwind opened this issue Mar 22, 2013 · 15 comments
Closed

zsh: command not found: j #196

shepherdwind opened this issue Mar 22, 2013 · 15 comments

Comments

@shepherdwind
Copy link

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
Copy link
Contributor

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?

@shepherdwind
Copy link
Author

yes, zsh is default shell.

$ echo $SHELL
/bin/zsh

@spinningarrow
Copy link
Contributor

Try adding this to your .zshrc:

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

@sloria
Copy link

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
Copy link
Owner

wting commented May 14, 2013

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

@shepherdwind
Copy link
Author

Reinstall is fine, no problem, thanks.

@maxscott
Copy link

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
Copy link

iClosedz commented Oct 4, 2014

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.

@jbranchaud
Copy link

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
Copy link
Owner

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?

@ical10
Copy link

ical10 commented Dec 13, 2020

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

@Swchexit
Copy link

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

Autojump is working fine on my old 2014 mac(big sur), but when i transfer to a m1 pro mbp, this happened.
Luckily, adding this line to .zshrc fix it.
macbook pro w/ m1 pro, Monterey, zsh5.8, autojump 22.5.3

@medev21
Copy link

medev21 commented Apr 25, 2022

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

Looks like this command has changed at some point, but as of now it's a bit different.

After installing autojump with brew, brew install autojump

run brew info autojump

it will print out the edit you need to make in your .zshrc/bash file

reference:

[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh

@seanonthenet
Copy link

Could this not be part of the brew formula?

@yenjuu
Copy link

yenjuu commented Mar 19, 2023

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.

This one solved for me. Thanks a lot.
MacBook Pro / M1 Pro, Ventura, zsh 5.8.1, autojump 22.5.3

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

No branches or pull requests