LoginSignup
7
5

More than 5 years have passed since last update.

簡単にMacから全てのディスクを取り外す

Last updated at Posted at 2018-08-12

やりたいこと

MBPの持ち出しのときに、ディスクのアンマウントをディスク数分行う必要があり、煩雑に感じていました。(全部をマウスで選択してcommand + eを押せばよいのですが煩わしいです)
macOSにて全ての外付けディスクのアンマウントを一回の操作で取り外したい。
その方法をメモします。

AppleScriptをAutomatorでサービス化し、ショートカットを割り当てる

利点はショートカット操作できることです。

スクリプトに直接ショートカットを割り当てたいが方法がない(と思われる)ので、Automatorでサービス化し、ショートカットを設定可能にする。

Automatorで「新規書類」→「サービス」(「ワークフロー」を選んでしまうと/Library/Services/に保存されないので注意)→「AppleScriptを実行」として、全ての取り出し可能なディスクを取り出すスクリプトを次のように書く。

on run {input, parameters}
    tell the application "Finder" to eject (every disk whose ejectable is true)
end run

次の選択項目を受け取る:「なし」を選択し、検索対象:「Finder」として保存する。

メニューの「Automator」→「サービス」→「サービス環境設定」と開き、「一般」の項目に増えた今作ったサービスを選択して、ショートカットを割り当てます。

7
5
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
7
5