打開用戶羣組偏好設置(可以在「系統偏好」設置裏選擇「用戶與羣組」,也可以屏幕右上角點自己的名字選擇「用戶與羣組偏好設置」)
選擇自己帳戶=>選擇登錄項=>選中不想開機自啓動的程序=>點擊下面的減(-)號
這種方法只能取消上面列出來的程序,但有些程序並沒有在這個列表裏顯示,比如razer的驅動配置程序,所以,這個辦法行不太通。之後查詢命令行的操作,找到了對應的方法:
有些程序在安裝的時候,會生成一個或幾個plist文件,用來執行開機自啓動,這樣的文件一般放在3個位置
/Library/LaunchDaemons/
/Library/LaunchAgents/
~/Library/LaunchAgents/
這裏有兩個LaunchAgents,一個是根目錄下,一個用戶目錄,一般打開終端後,用ls -l命令就可以看到一個Library,進入後,就能看到一個LaunchAgents目錄。如果用cd /Library即可進入根目錄下的Library目錄,裏面就有LaunchDaemons和另一個LaunchAgents目錄,裏面都有一些plist文件,oray的plist文件就在/Library/LaunchAgents/目錄裏
找到文件後,這裏需要使用launchctl命令來取消它
命令如下
cd /Library/LaunchAgents
ls -l
launchctl unload com.oray.sunlogin.agent.plist
輸出信息
(base) apple@appledeimac:~/Library/LaunchAgents$cd /Library/LaunchAgents
(base) apple@appledeimac:/Library/LaunchAgents$ls
com.microsoft.update.agent.plist com.oracle.java.Java-Updater.plist com.oray.sunlogin.agent.plist com.oray.sunlogin.startup.plist com.sogou.SogouServices.plist
(base) apple@appledeimac:/Library/LaunchAgents$ls -l
total 32
-rw-r--r-- 1 root wheel 352 11 13 09:10 com.microsoft.update.agent.plist
lrwxr-xr-x 1 root wheel 104 4 3 2019 com.oracle.java.Java-Updater.plist -> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Resources/com.oracle.java.Java-Updater.plist
-rwxr-xr-x 1 root wheel 748 5 15 2018 com.oray.sunlogin.agent.plist
-rw-r--r-- 1 root wheel 654 3 7 2018 com.oray.sunlogin.startup.plist
-rwxr-xr-x@ 1 root wheel 425 1 23 2019 com.sogou.SogouServices.plist
(base) apple@appledeimac:/Library/LaunchAgents$launchctl unload com.oray.sunlogin.agent.plist
(base) apple@appledeimac:/Library/LaunchAgents$launchctl unload com.oray.sunlogin.startup.plist
執行完兩條命令後,任務欄上的oray圖標就不見了,再開機也不會再啓動。
利用 launchctl list 可以看到會被自動帶起來的 service / processes