1. 首先检查安装状态
# 检查是否正确安装
brew list | grep autojump
# 检查安装路径
which autojump
2. 检查配置文件
对于 zsh 用户
# 打开配置文件
vim ~/.zshrc
# 确保添加以下内容(根据您的系统选择正确的路径)
# 对于 Intel Mac:
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
# 对于 M1/M2 Mac:
[ -f /opt/homebrew/etc/profile.d/autojump.sh ] && . /opt/homebrew/etc/profile.d/autojump.sh
对于 bash 用户
# 打开配置文件
vim ~/.bash_profile
# 添加相同的配置内容
3. 重新加载配置
# 如果使用 zsh
source ~/.zshrc
# 如果使用 bash
source ~/.bash_profile
4. 如果还是不工作,尝试重新安装
# 卸载 autojump
brew uninstall autojump
# 重新安装
brew install autojump
# 检查安装后的提示信息,确保按提示配置
5. 验证是否工作
# 进入一个目录
cd ~/Documents
# 到其他目录
cd ~/Downloads
# 尝试跳转回 Documents
j doc