LoginSignup
0
1

More than 3 years have passed since last update.

iOSの各種シミュレーターをfzfで選んで起動する

Last updated at Posted at 2020-05-28

プリミティブな方法だと

$ xcrun simctl list

で、起動したいシミュレーターのUUIDを確認して

$ xcrun instruments -w 208E5166-9C5D-4CA5-A9DE-529AD562D311 # iPhone 11 Pro Max

とすると指定したシミュレーターが起動するのだが、Xcodeをアプデするとシミュレーターも更新されてしまうので、以前書き留めておいたUUIDが使えなくなる。また調べないといけなくてめんどくさい。

ということで、インクリメンタルに端末名で検索してEnterで起動するようにした。

.zshrc に以下を追記

.zshrc
function simc() {
  xcrun instruments -w $(xcrun simctl list | grep -v unavailable | grep -E "^\s" | grep -v ":" | fzf  | grep -oE "\((.+?)\)" | grep -oE ".{20,}" | head -n1 | perl -pe "s/(\(|\))//g" )
}

fzfが入ってないなら以下を実行。

$ brew install fzf

設定を読み込み直して実行。

source ~/.zshrc

simc.gif

0
1
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
0
1