MacOS使用
快捷键
按键 | 行为 | 按键 | 行为 |
---|---|---|---|
command + shift + 3 |
系统截屏,并保存到桌面 | command + control + a |
微信截屏(需要设置) |
command + fn + F3 |
显示桌面 | command + tab |
快速切换应用 |
command + tab + alt + enter |
打开最小化的应用 | command + M |
最小化应用 |
command + left |
回到开始,Home | command + right |
到最后,End |
option + left |
到上一个单词开头 | option + right |
到下一个单词结尾 |
control + left |
到上一个桌面 | control + right |
到下一个桌面 |
fn + left |
跳到文章开头 | fn + right |
跳到文章结尾 |
fn + up |
到上一页 | fn + down |
到下一页 |
command + s |
保存文件 | command + c |
复制 |
command + v |
粘贴 | command + x |
剪切 |
command + space |
聚焦搜索,全局搜索软件或文件 | control + command + Q |
快捷锁屏,和QQ快捷键冲突 |
control + a |
转到行首(命令行下) | control + e |
转到行尾(命令行下) |
command + Q |
关闭活动程序 | command + W |
关闭活动窗口 |
触控板
动作 | 行为 | 动作 | 行为 |
---|---|---|---|
双指左右滑动 |
切换页面 | 双指从右边缘向左滑动 |
唤出通知中心 |
三只下划 |
聚焦当前应用 | 三指上划 |
平铺打开的应用 |
四指内合 |
调出启动台 | 四指张开 |
显示桌面(在非全屏状态下) |
三指左右滑动 |
切换页面 |
Brew命令
命令 | 功能 |
---|---|
brew ls |
查看本地安装的软件 |
brew search |
搜索软件 |
brew -v |
查看brew的版本 |
brew update |
升级brew |
brew install 软件名 |
安装软件 |
brew remove 软件名 |
卸载软件 |
brew 彻底卸载软件方法
brew tap beeftornado/rmtree
- 安装rmtreebrew rmtree 软件名
- 删除软件brew cleanup
- 清理缓存
必备软件
scroll reverser
解决鼠标滑动方向是反着的问题,下载地址:scroll reverser官网
Trojan X
Mac 下科学上网软件,好用方便,下载地址:JimLee1996的github
sequel pro
Mac 下免费的MySQL数据库图形化软件,下载地址:sequel pro 官网
软件技巧
添加快捷键输出当前时间
- 自动操作 -> 新建文稿 -> 快速操作 -> 实用工具 -> 允许shell脚本 -> 选择(没有输入、位于任何应用程序、用输出内容替换所选文本)
- 脚本内容填写
date "+%Y-%m-%d %H:%M:%S"
- 保存 -> 设置快捷键
最小化软件和恢复最小化软件
command m
- 最小化当前窗口
command option m
- 最小化当前软件所有窗口
command Tab
选中软件后松开 Tab
按键,再按 option
按键,松开 command
按键即可恢复最小化软件
command Tab
选中软件后松开 Tab
按键,再按 option
按键后再按 enter
按键即可恢复最小化软件
Finder 显示隐藏文件
command + shift + .
- 显示所有文件
使用问题
鼠标滚轮方向反着
将系统偏好设置>鼠标>滚动方向
前面的勾去掉即可,该操作会影响触控板的划动方向,替代方式可以使用scroll reverser软件
Finder进入根目录
进入访达>偏好设置>边栏
中,将硬盘前面选择为勾即可
安装HomeBrew
本命令中使用到的镜像源全部为国内的镜像源
命令行输入:
1 | /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" |
参考文档:mac安装homebrew失败怎么办?
关闭浏览器快速前进和后退
Edge:
1 | defaults write com.microsoft.edgemac AppleEnableSwipeNavigateWithScrolls -bool false |
Chrome
1 | defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false |
安装mysqlclient遇到lssl等错误
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip --no-cache install mysqlclient==1.4.6 -i https://mirrors.aliyun.com/pypi/simple
参考自:Macos安装报错 ld: library not found for -lssl
mac下网络冲突的问题
在配置文件中添加:
1 | "default-address-pools": [ |
禁止.DS_Store文件生成
禁止生成
1 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE |
恢复生成
1 | defaults delete com.apple.desktopservices DSDontWriteNetworkStores |
隐藏和显示以点开头的文件
隐藏
1 | defaults write com.apple.Finder AppleShowAllFiles YES |
显示
1 | defaults write com.apple.Finder AppleShowAllFiles NO |
xcode命令报错
现象:报错gyp: No Xcode or CLT version detected!
解决:
1 | sudo rm -rf $(xcode-select -print-path) |
在执行xcode-select --install
时,可能会报错:不能安装该软件,因为当前无法从软件更新服务器获得。
解决:在apple develop搜索 command line tools下载安装即可
mac不支持小于4位的密码
pwpolicy -clearaccountpolicies
- 关闭密码安全检查
passwd
- 命令行修改密码
长按组合键不能持续输入
使用一下命令后然后重启即可
defaults write NSGlobalDomain ApplePressAndHoldEnabled -boolean false
defaults write -g ApplePressAndHoldEnabled -bool false
ssl 证书问题
开发过程中突然遇到如下问题:
certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)')]
解决办法:
- finder 中搜索
Install Certificates.command
- 用终端运行,安装完成即可
terminal命令
traceroute 192.168.1.1
- 查看网络请求的具体访问过的地址
lsof -i tcp:3306
- 查看端口占用
lsof -i -n -P
- 查看所有端口占用
open -n /Applications/WeChat.app/Contents/MacOS/WeChat
- 实现双开微信
brew cask install qlcolorcode
- quicklook支持预览代码
brew cask install qlmarkdown
- quicklook支持预览markdown
右键添加 vscode 打开文件夹或文件
打开
自动操作.app
command + N
新建文稿,类型选择快速操作分别选择
实用工具
->运行shell脚本
->工作流程收到当前文件或文件夹 位于 Finder.app
->传递输入作为自变量
贴入代码
1
2
3
4for f in "$@"
do
open -a "Visual Studio Code" "$f"
donecommand + s
保存为用 VSCode 打开
编辑该脚本:
文件
- 打开
- ~/资源库 / Services / 用 VSCode 打开.workflow