常用快捷键
# 所有 F1 等按键需要配合 fn 键来使用,即 fn + F1
# 显示桌面 :fn + F11
# 剪切,先 Command + C 复制文件,然后到移动的位置, Command + Option(Alt) + V
# 显示隐藏文件 :Command + Shift + .
# IDEA 删除选中的行 Command + delete ; PyCharm Command + Y
# 打开浏览器开发者模式 :Command + Option(Alt) + I
# 锁屏 :Ctrl + Command + Q
# 切换程序 :Command + Tab
# 退出程序 :Command + Q
# 程序内切换下/上一个 active 窗口 :Command + ` / Command + Shift + `
# 关闭窗口 :Command + W
Mac 打开 sshd
# 启动
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
# 停止
sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist
HomeBrew
类似 CentOS yum
# 安装
$ brew install <formula>
# 禁用自动更新
export HOMEBREW_NO_AUTO_UPDATE=true
# 查看安装软件的信息,
$ brew info maven
maven: stable 3.6.2
Java-based project management
https://maven.apache.org/
Conflicts with:
mvnvm (because also installs a 'mvn' executable)
/usr/local/Cellar/maven/3.6.2 (71 files, 10.2MB) * # 软件安装路径,`*`为当前激活的版本
Built from source on 2019-11-14 at 23:06:39
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/maven.rb # 软件下载来源,可以从这里通过 git history 找到其他版本的软件
==> Requirements
Required: java >= 1.7 ✔
==> Analytics
install: 42,315 (30 days), 144,453 (90 days), 527,655 (365 days)
install_on_request: 40,530 (30 days), 136,403 (90 days), 497,483 (365 days)
build_error: 0 (30 days)
# 查看formula的历史版本
# 方案一
浏览器访问 https://github.com/Homebrew/homebrew-core/blob/master/Formula/maven.rb
点击 history 查看历史提交版本
# 方案二
# 进入 homebrew/core
$ cd "$(brew --repo homebrew/core)"
# 查看指定文件的 git commit 记录
$ git log master -- Formula/maven.rb
commit 6929ce5b5cec915173d0fc809a7a70a45cd77e9f
...
# 切回到指定的历史版本
$ git checkout 6929ce5b5cec915173d0fc809a7a70a45cd77e9f
# 安装历史版本
$ brew install maven --with-openssl@1.1
# 切回最新的版本
$ git checkout master
# Note > Warning: homebrew/core is shallow clone. To get complete history run:
$ git -C "$(brew --repo homebrew/core)" fetch --unshallow
# 查看本地以安装<formula>历史版本
$ brew list maven --versions
maven 3.6.2 3.6.1
# 切换版本
$ brew switch maven 3.6.1
更换 HomeBrew 镜像
# 替换 brew.git 仓库地址,默认(https://github.com/Homebrew/brew.git)
$ cd "$(brew --repo)"
$ git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
# 替换 homebrew-core.git 仓库地址,默认(https://github.com/Homebrew/homebrew-core.git)
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
$ git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
# 替换 homebrew-bottles 访问地址
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
$ source ~/.zshrc