😎

iOSシミュレーターのデータ保存場所を簡単に得るコマンド

に公開

xcrun simctl コマンドを活用すれば、Library > Xcodeを開いて...などFinderから手動で探す必要がなく、簡単にアクセスできます。

起動中のシミュレーターIDを取得

xcrun simctl list devices | grep Booted

データコンテナのURLを取得(これがメイン!)

xcrun simctl get_app_container <deviceId> <bundleId> data

  • deviceId: 前段のコマンドで取得できたシミュレーターID
  • bundleId:com.mydomain.AppNameの形式のバンドルID

起動中のシミュレーターが1つの場合は下記でも取得できます。
xcrun simctl get_app_container booted <bundleId> data

取得したURLをopenコマンドで開いてください。ディレクトリが開いて簡単にアクセスできたはずです。

AppGroupsのコンテナを取得

xcrun simctl get_app_container <deviceId> <bundleId> groups でコンテナのURLを取得することもできます。

参考記事

https://medium.com/@liwp.stephen/find-app-data-path-for-ios-simulator-6bba3d2fbab6

GitHubで編集を提案

Discussion