6
7

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 5 years have passed since last update.

Macのネットワーク環境をコマンドラインからpecoで選択して変更

Last updated at Posted at 2015-03-06

scselectコマンドで、コマンドライン(ターミナル)からMacのネットワーク環境を選択できる。

$ scselect
Defined sets include: (* == current set)
 * 05522B10-xxxx-xxxx-xxxx-xxxxxxxxxxxx	(Automatic)
   1781AE2D-xxxx-xxxx-xxxx-xxxxxxxxxxxx	(USB)
$ scselect USB
CurrentSet updated to 1781AE2D-xxxx-xxxx-xxxx-xxxxxxxxxxxx (USB)
$ scselect
Defined sets include: (* == current set)
   05522B10-xxxx-xxxx-xxxx-xxxxxxxxxxxx	(Automatic)
 * 1781AE2D-xxxx-xxxx-xxxx-xxxxxxxxxxxx	(USB)

pecoで選択して変更してみる。

$ scselect | sed -e 1d -e 's/[^(]*(\(.*\))/\1/g' | peco --prompt "Select network env:" | xargs scselect

エイリアスとかしておくと、簡単にネットワーク環境を切り替えられる。

具体的には、iPhoneをMacBook AirにUSB接続したとき、テザリングするやつとしないやつの切り替えに利用している。

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?