
mac 常见问题
常见操作
- 快速跳转到字符串头尾:
command + <-
- 想复制的话:
shift+command + <-
- 切换隐藏文件的显示状态:
Command + Shift + .
- goland返回上一步 :
option+command+ <-
如何判断是否支持某个命令
shell
command -v brew
安装Homebrew
执行命令
shell
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
在安装最后,特别注意终端输出的提示信息!
shell
==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/你的用户名/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- 对于基于 Apple Silicon (M1/M2/M3) 芯片的 Mac:Homebrew 默认安装在 /opt/homebrew 目录下,您必须执行这两行命令来将 brew 添加到当前 shell 和未来的终端会话的 PATH 环境变量中。
执行完上述命令后,重启您的终端 或者运行 source ~/.zprofile (或 ~/.bash_profile,具体取决于您的 shell 和安装提示) 来使配置立即生效。
如何确定到底是哪个 Shell?
在终端中运行:echo $SHELL
- 如果输出是 /bin/zsh 或 /usr/bin/zsh → 你使用的是 zsh。
- 如果输出是 /bin/bash → 你使用的是 bash。
情况 | 应该运行的命令 |
---|---|
使用 zsh(默认,macOS Catalina 及以后) | source ~/.zprofile |
使用 bash | source ~/.bash_profile |
不确定?先查 echo $SHELL | 根据结果选择 |