4
0

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 1 year has passed since last update.

#Mac で SOCKS proxy の設定をコマンドだけで実行する

Last updated at Posted at 2019-11-23

これだけ

sudo networksetup -setsocksfirewallproxy <NETWORK_SERVICE_NAME> localhost <PORT>
sudo networksetup -setsocksfirewallproxystate <NETWORK_SERVICE_NAME> on

で OK

具体例

sudo networksetup -setsocksfirewallproxy Wi-fi localhost 10080
sudo networksetup -setsocksfirewallproxystate Wi-fi on

結果

Settings > Network > (NETWORK_SERVICE_NAME) のタブ > Proxies > SOCKS proxy

が設定され、有効になる。

image

有効化 / 無効化の例

sudo networksetup -setsocksfirewallproxystate Wi-fi on
sudo networksetup -setsocksfirewallproxystate Wi-fi off

ネットワークサービス名の一覧を確認する

networksetup -listallnetworkservices

Mac の Settings > Network でのサイドバーと同じものっぽい

$ networksetup -listallnetworkservices
An asterisk (*) denotes that a network service is disabled.
Wi-Fi
iPhone USB
Bluetooth PAN
Thunderbolt Bridge

image

SOCKS proxy の起動は

ssh -ND 10080 user@password -i key-file

Ref

こちらの抜粋

osx で socks proxy の設定を command line で完結させる - Qiita

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?