Homebrew

Installation:

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

During the installation, enter the password and confirm the installation

$Git download: error: RPC failed; Curl 18 transfer closed with outstanding read data Remaining, curl 18 transfer closed with outstanding read data remaining,

$git config –global http.proxy http://127.0.0.1: port number $git config –global http.proxy http://127.0.0.1: port number

Installation successful:

You can test whether the installation was successful with $brew –help

Uninstall:

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

Install LRZSZ

$ brew install lrzsz

After the installation, go to $CD /usr/local/bin

Create the file and add the content

$ vi iterm2-recv-zmodem.sh
$ vi iterm2-send-zmodem.sh
Copy the code

Once created, add content to the two files separately

  1. Iterm2 recv - zmodem. Sh:
#! /bin/bash # Author: Matt Mastracci ([email protected]) # AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script # licensed under cc-wiki with attribution required # Remainder of script public domain osascript -e 'tell application "iTerm2" to version' > /dev/null  2>&1 && NAME=iTerm2 || NAME=iTerm if [[ $NAME = "iTerm" ]]; then FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"` else FILE=`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose folder with prompt "Choose a folder to place received files in"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"` fi if [[ $FILE = "" ]]; then echo Cancelled. # Send ZModem cancel echo -e \\x18\\x18\\x18\\x18\\x18 sleep 1 echo echo \# Cancelled transfer else  cd "$FILE" /usr/local/bin/rz -E -e -b sleep 1 echo echo echo \# Sent \-\> $FILE fiCopy the code
  1. Iterm2 - send - zmodem. Sh:
#! /bin/bash # Author: Matt Mastracci ([email protected]) # AppleScript from http://stackoverflow.com/questions/4309087/cancel-button-on-osascript-in-a-bash-script # licensed under cc-wiki with attribution required # Remainder of script public domain osascript -e 'tell application "iTerm2" to version' > /dev/null  2>&1 && NAME=iTerm2 || NAME=iTerm if [[ $NAME = "iTerm" ]]; then FILE=`osascript -e 'tell application "iTerm" to activate' -e 'tell application "iTerm" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"` else FILE=`osascript -e 'tell application "iTerm2" to activate' -e 'tell application "iTerm2" to set thefile to choose file with prompt "Choose a file to send"' -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")"` fi if [[ $FILE = "" ]]; then echo Cancelled. # Send ZModem cancel echo -e \\x18\\x18\\x18\\x18\\x18 sleep 1 echo echo \# Cancelled transfer else  /usr/local/bin/sz "$FILE" -e -b sleep 1 echo echo \# Received $FILE fiCopy the code

After the file is written and saved, use the following command to add permissions:

$ chmod 777 iterm2-*

Edit the iTerm

Click the Edit button triggering iTerm2 Settings -> Profiles -> Default -> Advanced -> Triggers and add the following configuration:

Regular expression: rz waiting to receive.\*\*B0100
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-send-zmodem.sh

Regular expression: \*\*B00000000000000
Action: Run Silent Coprocess
Parameters: /usr/local/bin/iterm2-recv-zmodem.sh
Copy the code

test

Rz upload: In Bash, the iTerm2 terminal type Rz and the file selection box will pop up. Select the file Choose and upload the file to the current directory

Sz download function: sz fileName(the name of the file you want to download) press enter, the form will pop up, we select the place to save.

blog

Welcome to my blog