How to easily forward/redirect all network traffics through local socks port 1080? How to easily forward/redirect all network traffics through local socks port 1080? I did google this before asking question. I found this link and this link and others too. But there is no simple solution. 
(The system preferences network proxy setup just don't work for all apps. ) 
Is that so hard to do it? I think just some iptables rules should do it. (although I don't know what is the equivalent iptables command in macos, maybe pfctl?). Can anyone show me some simple shell scripts which can achieve this? Thank you very much.
Since nobody posts a shell script (or easy way) to solve my question, I posted my current workaround solution:


Install virtualbox
Install openwrt as the guest OS to virtualbox
Configure the openwrt to become a router which has the lan IP of 192.168.56.2. The lan interface is a Host-only adapter. The wan interface is Bridged adapter. 
Configure the openwrt router to do the transparent proxy job that I want.
Change both gateway and DNS to 192.168.56.2 in the host. 


to change the gateway: sudo route change default 192.168.56.2
to change the DNS: must use the UI way. System Preferences --> Network --> Adavanced --> DNS



That's all. So far so good.