4
4

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 OS Xのターミナル上でWi-Fiの設定を追加・削除する

Last updated at Posted at 2016-06-17

定期的にパスワードが変更になるWi-Fi環境の場合、記憶済みのパスワードを削除したあとに新しいパスワードを登録する作業をやるのが結構面倒くさい。

調べたところ、ターミナルから設定を追加/削除できるコマンドがあった。新しいパスワードを取得して設定を書き換えるまでスクリプト化できて大変便利。

古いWi-Fi設定の削除

$ networksetup -removepreferredwirelessnetwork en0 SSID_OF_NETWORK

新しいWi-Fi設定の追加

$ networksetup -addpreferredwirelessnetworkatindex en0 SSID_OF_NETWORK INDEX_NUMBER SECURITY_OF_WIRELESS_NETWORK WIRELESS_NETWORK_PASSPHRASE
  • INDEX_NUMBER: 優先度を整数で指定する。"0"が優先度最高で、リストの先頭にくることになる
  • SECURITY_OF_WIRELESS_NETWORK: いずれかを指定
    • OPEN
    • WEP
    • WPA
    • WPA2
    • WPAE
    • WPA2E

参考

4
4
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?