LoginSignup
11
11

More than 5 years have passed since last update.

Removing only all App Store Applications

Last updated at Posted at 2014-03-05

Of course you should wipe the HDD if you sell your Mac, but this script (Ruby 1.8.7 or 2.0.0) could be useful if you are just renewing your Mac in your Office and returning the old one.

[App Storeアプリだけを全て削除する]

売るときは完全ワイプのほうが良いと思いますが、例えば会社や研究室のMacを新調して古いMacをお返しするときなどには使えるのでは。

Ruby 1.8.7と2.0.0で(rm_r以外)動作確認しました。10.9でなくとも大丈夫です。

[追記] Ruby 2.0.0とOSX 10.9の組み合わせで正常に削除成功しました。

unappstore.rb
#!/usr/bin/env ruby
require 'fileutils'
Dir.glob('/Applications/*.app').select{|e|File.exist?(e+'/Contents/_MASReceipt')}.each{|app|
    puts app
    FileUtils.rm_r(app,{:force=>true,:secure=>true}) # need sudo
}
11
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
11