Mac从OS X以来发展也有十多年了,此间硬件变化很大,而系统默认设置出于各种原因比较保守,需要做些调整才能更好的发挥效力。

加快Samba文件传输速度

printf "[default]\nsigning_required=no\n" | sudo tee /etc/nsmb.conf >/dev/null

避免休眠写磁盘,加快唤醒速度

sudo pmset -a hibernatemode 0

优化Mail.app本地数据库

使用Brett Terpstra提供的Mail vacuuming script

使用noatime挂载文件系统

  • 创建 /Library/LaunchDaemons/com.nullversion.noatime.plist ,内容:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
            "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
        <dict>
            <key>Label</key>
            <string>com.nullvision.noatime</string>
            <key>ProgramArguments</key>
            <array>
                <string>mount</string>
                <string>-vuwo</string>
                <string>noatime</string>
                <string>/</string>
            </array>
            <key>RunAtLoad</key>
            <true/>
        </dict>
    </plist>
    
  • 设置文件权限

    1
    2
    
    sudo chown root:wheel /Library/LaunchDaemons/com.nullversion.noatime.plist
    sudo chmod 644 /Library/LaunchDaemons/com.nullversion.noatime.plist
    

    那像我这样还另外还插了一张JetDrive闪存卡做扩展磁盘的话要怎么办呢?

    再加上一个plist文件 /Library/LaunchDaemons/com.nullversion.noatime-transcend.plist

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
            "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
        <dict>
            <key>Label</key>
            <string>com.nullvision.noatime-transcend</string>
            <key>OrderPreference</key>
            <string>Last</string>
            <key>ProgramArguments</key>
            <array>
                <string>mount</string>
                <string>-vuwo</string>
                <string>noatime</string>
                <string>/Volumes/Transcend</string>
            </array>
            <key>RunAtLoad</key>
            <false/>
            <key>StartInterval</key>
            <integer>60</integer>
            <key>LaunchOnlyOnce</key>
            <true/>
            <key>KeepAlive</key>
            <false/>
        </dict>
    </plist>
    

开启TLS 1.3支持(macOS 10.13+)

sudo defaults write /Library/Preferences/com.apple.networkd tcp_connect_enable_tls13 1

禁止在网络卷上生成.DS_Store文件

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

强制打开aptX

  1. Apple开发者网站下载Additional Tools for Xcode ,解压dmg,打开Hardware目录下Bluetooth Explorer应用
  2. Tools -> Audio Options,勾选Codecs -> Force use of aptX aptX
  3. 使用命令行设置开启aptX sudo defaults write bluetoothaudiod "Enable AptX codec" -bool true
  4. 切换成AAC sudo defaults write bluetoothaudiod "Enable AAC codec" -bool true

开启「系统偏好设置 - 安全与隐私 - 通用」中「允许任何来源应用运行」的选项

sudo spctl --master-disable

禁用Java的自动更新检测

sudo defaults write /Library/Preferences/com.oracle.java.Java-Updater JavaAutoUpdateEnabled -bool false

禁用Google各类应用的自动更新检测

defaults write com.google.Keystone.Agent checkInterval 0
launchctl unload -w /Library/LaunchAgents/com.google.keystone.agent.plist

未完待续

参考