参考链接

  1. 备份dynamic_pager.plist
1
2
cd /System/Library/LaunchDaemons
sudo cp com.apple.dynamic_pager.plist{,_bak}
  1. 将plist转换为xml格式
1
sudo plutil -convert xml1 com.apple.dynamic_pager.plist
  1. 编辑plist文件, 比如我的,请根据自身情况修改路径
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs$
<plist version="1.0">
<dict>
    <key>EnableTransactions</key>
    <true/>
    <key>HopefullyExitsLast</key>
    <true/>
    <key>Label</key>
    <string>com.apple.dynamic_pager</string>
    <key>OnDemand</key>
    <false/>
    <key>ProgramArguments</key>
    <array>
         <string>/bin/bash</string>
         <string>-c</string>
         <string>/bin/wait4path /Volumes/Swap/ &amp;&amp; /sbin/dynamic_pager -F /Volumes/Swap/.vm/swapfile</string>
    </array>
</dict>
</plist>
  1. 将plist转换为binary
1
sudo plutil -convert binary1 com.apple.dynamic_pager.plist

搞定