Autojump: What to source to make this work on macOS after installing with Homebrew?

Created on 27 Nov 2017  ·  13Comments  ·  Source: wting/autojump

I can't get it to work.

Always get this message:

Please source the correct autojump file in your shell's
startup file. For more information, please reinstall autojump
and read the post installation instructions.

Thank you for any help.

Most helpful comment

you can see the caveat again using command

brew info autojump

and it will give you the output

autojump: stable 22.5.1 (bottled), HEAD
Shell extension to jump to frequently used directories
https://github.com/wting/autojump
/usr/local/Cellar/autojump/22.5.1 (24 files, 253.9KB) *
  Poured from bottle on 2017-11-28 at 13:37:16
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/autojump.rb
==> Caveats
Add the following line to your ~/.bash_profile or ~/.zshrc file (and remember
to source the file to update your current session):
  [ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh

If you use the Fish shell then add the following line to your ~/.config/fish/config.fish:
  [ -f /usr/local/share/autojump/autojump.fish ]; and source /usr/local/share/autojump/autojump.fish

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions

All 13 comments

did you try the part where it says "read the post installation instructions"?

https://github.com/wting/autojump#installation

I have. For macOS, it only says to brew install it and that's it.

and brew install shows you instructions after install. There is a reason it's there.

https://github.com/Homebrew/homebrew-core/blob/b6b9f36c8744c2259b74f12850163c676ae49396/Formula/autojump.rb#L27-L35

you can see the caveat again using command

brew info autojump

and it will give you the output

autojump: stable 22.5.1 (bottled), HEAD
Shell extension to jump to frequently used directories
https://github.com/wting/autojump
/usr/local/Cellar/autojump/22.5.1 (24 files, 253.9KB) *
  Poured from bottle on 2017-11-28 at 13:37:16
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/autojump.rb
==> Caveats
Add the following line to your ~/.bash_profile or ~/.zshrc file (and remember
to source the file to update your current session):
  [ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh

If you use the Fish shell then add the following line to your ~/.config/fish/config.fish:
  [ -f /usr/local/share/autojump/autojump.fish ]; and source /usr/local/share/autojump/autojump.fish

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions

Still doesn't work for me even after adding [ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh & sourcing the file.

I do j <dirname> and am left in my current directory instead of changing dirs.

You have to cd <dirname> first than autojump will remember it for you the next time you call j <dirname>

Ahh, gotcha, I misunderstood the purpose, so then autojump is more about remembering where you've been so you can go back there quickly rather than finding a deeply nested subdir from your current location?

Yes, as cited from the README.md

It works by maintaining a database of the directories you use the most from the command line.

_Directories must be visited first before they can be jumped to._

I'm also running into this issue.
After installing through Homebrew, I added this to my .bash_profile:
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
I also made sure to add:
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} history -a"

After cd'ing into a few directories, j -s has no entries. I have to manually run the .bash_profile line in my current session. Is this a config issue with my .bash_profile somehow?

having the same issue as @helenes-r7

After installing through Homebrew, I added this to my .bash_profile:
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh

After cd'ing into a few directories, j -s has no entries.

And yes, I did source ~/.bash_profile to reload the session

@helenes-r7 @l-gothberg You can read about the question here https://apple.stackexchange.com/questions/12993/why-doesnt-bashrc-run-automatically

Thanks @bendem and @aphe for chiming in.

Autojump is a unique in the sense that it requires post-installation setup since every users are using different shells and potentially customized setups, and some package distributions don't allow post install configuration (e.g. Debian).

I plan on improving the post installation step in #323 so please redirect feedback there.

It would be great to have this in the readme:

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

I didn't read the post install instructions (sorry!), I just assumed it would work out of the box.
Maybe this can also be added next-to/instead-of "read post install instructions"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grota picture grota  ·  16Comments

paultopia picture paultopia  ·  9Comments

dotimes picture dotimes  ·  4Comments

shepherdwind picture shepherdwind  ·  11Comments

davux picture davux  ·  9Comments