這些維護程式都是OSX作業系統所提供的,如果您熟悉終端機模式,也可以藉由command來達到
相同的功能。
我將我所知道的指令用Automator來做成一個小程式,藉此讓您了解OnyX所做的一些功能。
每個功能及所對應的終端機指令:
1.Periodic Cleanup : sudo periodic daily weekly monthly
2.Clear Cache Files :
sudo rm -f -PR ~/Library/Caches/*
sudo rm -f -PR /Library/Caches/*
sudo rm -f -PR /System/Library/Caches/*
3.Verify Preference Files : sudo plutil ~/Library/Preferences/*.plist
4.Repair Permissions : sudo diskutil repairPermissions
5.Update Prebindings : sudo update_prebinding -root
6.Update Locate Database : sudo /usr/libexec/locate.updatedb
7.Update Whatis Database : sudo /usr/libexec/makewhatis -v
結果將儲存在桌面的 Log.txt 檔案
流程圖如下:

將下面AplleScript程式碼copy到Automator的執行AppleScript欄位中:

AppleScript程式碼:
set DIALOG01 to "Periodic Cleanup:定期清理(每日,每週,每月)?"
set DIALOG02 to "Clear Cache Files:清理快取?"
set DIALOG03 to "Verify Preference Files:驗證偏好檔案?"
set DIALOG04 to "Repair Permissions:驗證權限?"
set DIALOG05 to "Update Prebindings:更新軟體套件連結?"
set DIALOG06 to "Update Locate Database:更新資料庫?"
set DIALOG07 to "Update Whatis Database:更新Whatis資料庫?"
--Periodic Cleanup
display dialog DIALOG01 buttons {"跳過", "執行"} default button 2 with icon 0
set the button_pressed to the button returned of the result
if the button_pressed is "執行" then
do shell script "sudo periodic daily weekly monthly >> ~/Desktop/Log.txt" with administrator privileges
do shell script "sudo echo ----- Periodic Cleanup Finish :`date`>>~/Desktop/Log.txt" with administrator privileges
end if
--Clear Cache Files
display dialog DIALOG02 buttons {"跳過", "執行"} default button 2 with icon 0
set the button_pressed to the button returned of the result
if the button_pressed is "執行" then
do shell script "sudo rm -f -PR ~/Library/Caches/* >> ~/Desktop/Log.txt;sudo rm -f -PR /Library/Caches/* >> ~/Desktop/Log.txt;sudo rm -f -PR /System/Library/Caches/* >> ~/Desktop/Log.txt" with administrator privileges
do shell script "sudo echo ----- Clear Cache Finish :`date`>>~/Desktop/Log.txt" with administrator privileges
end if
--Verify Preference Files
display dialog DIALOG03 buttons {"跳過", "執行"} default button 2 with icon 0
set the button_pressed to the button returned of the result
if the button_pressed is "執行" then
do shell script "sudo plutil ~/Library/Preferences/*.plist>>~/Desktop/Log.txt" with administrator privileges
do shell script "sudo echo ----- Verify Preference Files Finish :`date`>>~/Desktop/Log.txt" with administrator privileges
end if
--Repair Permissions
display dialog DIALOG04 buttons {"跳過", "執行"} default button 2 with icon 0
set the button_pressed to the button returned of the result
if the button_pressed is "執行" then
do shell script "sudo diskutil repairPermissions / >> ~/Desktop/Log.txt" with administrator privileges
do shell script "sudo echo ----- Repair Permissions Finish :`date`>>~/Desktop/Log.txt" with administrator privileges
end if
--Update Prebindings
display dialog DIALOG05 buttons {"跳過", "執行"} default button 2 with icon 0
set the button_pressed to the button returned of the result
if the button_pressed is "執行" then
do shell script "sudo update_prebinding -root / >> ~/Desktop/Log.txt" with administrator privileges
do shell script "sudo echo ----- Update Prebindings Finish :`date`>>~/Desktop/Log.txt" with administrator privileges
end if
--Update Locate Database
display dialog DIALOG06 buttons {"跳過", "執行"} default button 2 with icon 0
set the button_pressed to the button returned of the result
if the button_pressed is "執行" then
do shell script "sudo /usr/libexec/locate.updatedb >> ~/Desktop/Log.txt" with administrator privileges
do shell script "sudo echo ----- Update Locate Database Finish :`date`>>~/Desktop/Log.txt" with administrator privileges
end if
--Update Whatis Database
display dialog DIALOG07 buttons {"跳過", "執行"} default button 2 with icon 0
set the button_pressed to the button returned of the result
if the button_pressed is "執行" then
do shell script "sudo /usr/libexec/makewhatis -v; >> ~/Desktop/Log.txt" with administrator privileges
do shell script "sudo echo ----- Update Whatis Database Finish :`date`>>~/Desktop/Log.txt" with administrator privileges
end if
將貼上後,按鐵鎚一下(compiler),看是否有錯誤!

正確的話,將Automator儲存成應用程式。
執行畫面:


在定期清理(每月),驗證權限,會比較花時間,需要等一下!
輸出Log.txt檔案內容:
