Brew Set Proxy Author: Chuwen Time: 2023-07-04 Classification: macOS comment ## 1. Find the location of 'brew' The general path is in '/usr/local/bin/brew', please record it, and you need to use it later ```shell ➜ ~ which brew /usr/local/bin/brew ``` ## 2. Move the 'brew' command location ```shell mv /usr/local/bin/brew /usr/local/bin/brew_orig ``` ## 3. Create a new file such as'. proxy 'to set proxy Execute the command 'vim~/. proxy. sh'. The file content is: >The following proxy server addresses are adjusted according to your actual situation ```shell #!/ bin/bash export https_proxy= http://127.0.0.1:7890 export http_proxy= http://127.0.0.1:7890 export all_proxy=socks5://127.0.0.1:7890 ``` ## 4. New '/usr/local/bin/brew' file Execute Command ` vim/usr/local/bin/brew` The contents of the document are: ```shell #!/ bin/bash source ~/.proxy.sh /usr/local/bin/brew_orig "$@" ``` And give executable permission ` chmod+x/usr/local/bin/brew` ## 5. Test Use ```shell ➜ ~ cat $(which brew) #!/ bin/bash source ~/.proxy.sh /usr/local/bin/brew_orig "$@" ➜ ~ brew --version Homebrew 4.0.26 Homebrew/homebrew-core (git revision 3112e690293; last commit 2022-07-12) Homebrew/homebrew-cask (git revision 2ae6e86efe; last commit 2023-02-16) ```
MacOS uses the command (networksetup) to set the PAC proxy Author: Chuwen Time: 2022-10-14 Classification: macOS comment Because the PAC set manually in the network settings ! [macOS Settings Network Proxy Auto Proxy Configuration]( https://cdn.nowtime.cc/2022/10/14/2421697647.png ) It may be shut down due to other software, for example, ClashX is set to replace the system agent ! [LashX set as system agent]( https://cdn.nowtime.cc/2022/10/14/681989366.png ) It is troublesome to replace manually, so I want to use the command to replace it ##Solution So I found a question and answer on the Internet[ https://apple.stackexchange.com/a/166443 ]( https://apple.stackexchange.com/a/166443 " https://apple.stackexchange.com/a/166443 "), use the command 'networksetup - setautoproxyurl' ###The syntax of networksetup - setautoproxyurl is as follows ```shell networksetup -setautoproxyurl <network services> <pac address> ``` ####Question 1: How can I get '<network services>'? You can get it through the 'networksetup - listallnetworkservices' command (just a guess, because I have a black Apple and an Ethernet card) ! [Results obtained by executing networksetup - listallnetworkservices - get all network service names]( https://cdn.nowtime.cc/2022/10/14/245596886.png ) ####Example 1 Set PAC address for Ethernet network card ```shell networksetup -setautoproxyurl "Ethernet" " http://192.168.30.87/autoproxy.pac " ``` Then check the following settings: ```shell networksetup -getautoproxyurl "Ethernet" ``` ! [Execute the networksetup - getautoproxyurl Ethernet command result]( https://cdn.nowtime.cc/2022/10/14/3672159431.png )
The macOS desktop cannot be operated and there is no file solution Author: Chuwen Time: 2021-05-13 Classification: macOS comment Execute the following command: ```shell defaults write com.apple.finder CreateDesktop true; killall Finder ```
[Using HoRNDIS] Android phones are shared to the macOS for Internet access via USB network Author: Chuwen Time: 2020-12-04 Classification: macOS comment #Install a driver HoRNDIS > GitHub: https://github.com/jwise/HoRNDIS/releases > GitHub Release: https://github.com/jwise/HoRNDIS/releases > >I used (* * Lanzou Cloud Disk Link * *): [HoRNDIS-9.2-catalina_install. pkg. zip] [1] Follow the prompts to install. After installation, * * restart the system * *. Then open * * Settings * * ->* * Personal hotspot and network sharing * * ->* * USB network sharing** ! [MIUI 12 Personal Hotspot Screenshot] [2] ###If everything goes well, an interface will be automatically added in your macOS ->System Settings ->Network ! [If everything goes well, an interface will be automatically added in your macOS ->System Settings ->Network] [3] #Disadvantages found When your phone turns off USB network sharing/unplugs the USB cable (data cable), plugs it in again and turns on USB network sharing, another interface will be automatically added If you observe carefully, you can see that there is (en3)`、`... (en4) ` These two interfaces. Yes, ' (en4) 'It was automatically added when I enabled USB network sharing before, but now I re enable it, and it is added again #Catalina 10.15.7 (19H15) test installation can work normally ! [Catalina 10.15.7 (19H15) ][4] --- Want to query in more detail? , please visit: https://cloud-atlas.readthedocs.io/zh_CN/latest/android/hack/android_usb_tethering.html [1]: https://nowtime.lanzous.com/i1xLAj1r4ij [2]: https://cdn.nowtime.cc/2020/12/04/849199925.png [3]: https://cdn.nowtime.cc/2020/12/04/1599352426.jpg [4]: https://cdn.nowtime.cc/2020/12/04/1308725480.jpg
Set an alias under the Mac to connect with SSH Author: Chuwen Time: 2020-11-27 Classification: macOS comment #Create folders/files first (if not) ``` mkdir ~/.ssh touch ~/.ssh/config ``` #Then edit the file `vim ~/.ssh/config` ``` #Server 1 Host alias HostName IP address Port 22 User User Name #Server 2 Host alias HostName IP address Port 22 User User Name ``` #Connection ``` Ssh alias ```