8
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Macの機能拡張をアンインストールする

Last updated at Posted at 2017-03-18

Mac 上で Xcode Source Editor Extension などの機能拡張をお試しで作ってデバッグ実行すると、システム環境設定の機能拡張にそのお試しアプリが登録されてしまいます。いつまでも設定が一覧に残っているのでそのうちアンインストールしたくなるわけですが、アプリ単体の場合と違ってファイルが各所に散らばっていて簡単ではありません。

機能拡張をアンインストールする手順をまとめてみました。

  1. お試しアプリのエクステンションの方のバンドル名を控えておきます。(Xcode でプロジェクトの General から TARGETS でエクステンションを選択するとBundle Identifierに表示されている値です。)
  2. Xcode を終了します。
  3. ユーザーごとのライブラリフォルダを開きます。(Finder の移動メニューをシフトキーを押しながら開くとライブラリという項目があるのでそれを選択します。)
  4. Application Scriptsフォルダを開いて、控えておいたバンドル名と同じ名前のフォルダを削除します。
  5. Containersフォルダを開いて、控えておいたバンドル名と同じ名前のフォルダを削除します。
  6. アプリ本体とエクステンションで情報共有するなどのために App Groups を使用している場合は、Group Containersフォルダを開いてアプリで使っている App Groups の ID と同じ名前のフォルダを削除します。

ちなみに、Xcodeからエクスポートしたアプリを単独で実行した場合は、AppCleanerを使ってアプリをアンインストールするとついでに機能拡張もアンインストールされます。

以上です。


2021-05-06
手順が面倒なので、ユーザーライブラリにあるバンドルのフォルダ名をダンプするスクリプトを書いてみました。

# !/bin/sh
#
#  List app's bundle folders in the user library
#

targets=($(xcodebuild -list | awk '/Targets:/,/^$/' | grep -Ev '(^$|:)' | sed -e 's/ //g'))
for target in ${targets[@]}
do
    bundles=($(xcodebuild -showBuildSettings -target ${target} | awk '/PRODUCT_BUNDLE_IDENTIFIER/ {print $3}'))
    for ((bundle_i = 0; bundle_i < ${#bundles[@]}; bundle_i++))
    do
        bundle=${bundles[$bundle_i]}
        
        echo "# ${bundle}"
        dirs=(
            "Application Support"
            "Containers"
            "Group Containers"
        )
        for ((dir_i = 0; dir_i < ${#dirs[@]}; dir_i++))
        do
            dir=${dirs[$dir_i]}
            
            path="${HOME}/Library/${dir}/${bundle}/"
            if [ -d "${path}" ]
            then
                echo ${path}
            fi
        done
    done
done
8
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
8
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?