コンピュータは使っている内に、徐々にゴミが溜まっていきます。分かりやすいファイルは自分で削除できますが、キャッシュや一時ファイルなど、ぱっと見では分かりづらいファイルの蓄積はなかなか削除できません。 そういったファイルをまとめて消してくれるスクリプトがmac-cleanupです。

mac-cleanupの使い方

mac-cleanupは名前の通り、macOS専用になります。インストールは次のコマンドで行います。

sh -c "$(curl -fsSL https://raw.githubusercontent.com/fwartner/mac-cleanup/master/installer.sh)"

後は cleanup コマンドを実行するだけです。Homebrewの整理で失敗することもあります。

$ cleanup
Empty the Trash on all mounted volumes and the main HDD...
Clear System Log Files...
Clear Adobe Cache Files...
Cleanup iOS Applications...
Remove iOS Device Backups...
Cleanup XCode Derived Data and Archives...
Cleanup iOS Simulators...
2020-05-11 13:36:03.435 simctl[72248:6917434] CoreSimulator detected version change.  Framework version (704.12.1) does not match existing job version (704.12).  Attempting to remove the stale service in order to add the expected version.
Cleanup CocoaPods cache...
Cleanup Google Chrome cache...
Cleanup Gradle cache...
  :
Success!
104 MiB of space was cleaned up

今回は104MBの整理に成功しました。これは肥大化したストレージで実行すれば、より効果がありそうです。毎日実行する必要はありませんが、半年に一回くらい実行すると、不要なファイルをまとめて削除できるでしょう。

mac-cleanupはShellスクリプト製のソフトウェア(ソースコードは公開されていますがライセンスは明記されていません)です。

fwartner/mac-cleanup: ?️Cleanup script for OSX