macOS 使用技巧
source link: http://blog.ponder.work/2021/10/10/macos-tips/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
对程序员来说,macOS 就是一个桌面支持比较好的 Linux/Unix,给日常开发带来了许多便利
本文记录一些日常使用中的小技巧。
macOS mojave 密码位数限制
苹果在10.14的系统上增加了密码最小长度的限制
可以通过这个命令去除
pwpolicy -clearaccountpolicies
注意:去除限制之后,通过time machine备份的系统,还原到有限制的机器上,可能会导致一些bug。如卡死在登陆页面,部分应用的资源库损坏等等。
重置账户、配置
如果出现上面的问题,可以尝试重置下系统设置(选择任意一种,建议选1或2)
- 新建管理员账号,在新机器上去除密码限制。
进入恢复模式(开机按command+r),删除对应用户账户配置文件(恢复模式下文件挂载路径可能不同), 重新开机
mv ~/Library/Preferences ~/Library/Preferences.bak
mv ~/Library/PreferencePanes ~/Library/PreferencePanes.bak清除机器配置状态,重新设置一个新账户(开机按住command+s;)
/sbin/mount -uaw
rm var/db/.applesetupdone
reboot
Mac 开启任何来源选项
sudo spctl --master-disable
让系统更流畅
macOS 10.14 以后系统动画越来越复杂,对显卡要求比较高,导致配置比较老的设备运行起来很卡顿。
特别是big sur系统,使用intel核显的机器都不建议安装。
通过关闭一些动画和特效可以让系统更流畅些
使用 karabiner 可以对系统全局快捷键和应用快捷键进行修改。
通过配置 karabiner 将 command,control,option 按键进行重映射,可以让 macOS 的键位 和 Windows/Linux 接近。
使 macOS 的命令风格与Linux相同
macOS 的命令应该是 Unix 风格的,和 Linux 有些不同,可选参数必须放在前面,会有些不方便。
比如
# mac
➜ ~ /bin/ls /tmp -al
ls: -al: No such file or directory
可以安装 gnu 工具,覆盖这些命令
brew install coreutils findutils gnu-tar htop
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
清除一些 macOS 系统默认快捷键
创建文件 ~/Library/KeyBindings/DefaultKeyBinding.dict
这里是清除了默认的 Control + Command + 方向键
的行为
{
"^@\UF701" = "noop:";
"^@\UF702" = "noop:";
"^@\UF703" = "noop:";
}
~
⌥ Option key
$
⇧ Shift key
^
^ Control key
@
⌘ Command key
#
keys on number pad
关闭启动声音
# 关闭提示音
sudo nvram StartupMute=%01
# 打开duang
sudo nvram StartupMute=%00
crontab 文件路径
用户执行crontab -e
之后定时任务存储位置/private/var/at/tabs/<username>
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK