赞
踩
我的mac信息:Apple M1 macOS Big Sur 11.4 (文末有截图)
已安装的忽略~~~
网上有很多安装教程,用的大部分都不可以,下面这个作者将所以过程都可视化的展示出来,懂中文的一看便会!!!赞
# 安装命令:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
执行完后,要按照提示,退出重新打开item2或者 source 一下你的 .zprofile
来源链接:https://zhuanlan.zhihu.com/p/111014448
brew install lrzsz
备注:这一步如果有报错信息,一般就是你的Homebrew安装失败了,用第一步上面的安装命令重新安装接口,它会自动给你卸载掉旧版本。
网上都说这两个脚本,要放在cd /usr/local/bin 这个目录下,但item2配置的话,是可以放在任意自定义文件夹下的,只要item2里配置目录对应起来即可~~~
vi iterm2-recv-zmodem.sh
#!/bin/bash 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 #/opt/homebrew/bin/rz -E -e -b # 注意:这是我的配置 sleep 1 echo echo echo \# Sent \-\> $FILE fi
vi iterm2-send-zmodem.sh
#!/bin/bash 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 # /opt/homebrew/bin/sz "$FILE" -e -b # 注意:这是我的配置 sleep 1 echo echo \# Received $FILE fi
注意:我这两个脚本和网上给的不一样!不一样!不一样!
需要注意的是iterm2-recv-zmodem.sh 的第19行 和 iterm2-send-zmodem.sh 的第17行
要换成系统里 rz 和 sz 的默认路径
可以通过一下命令查看
像我的系统,lrzs默认放在了 /opt/homebrew/bin/ 下,
我就需要将两个脚本中的 rz 和 sz 的目录替换成自己的路径!!!
但注意:需要配置可执行权限
chmod 755 iterm2-*.sh
不然到item2中使用的时候,会报错说
/usr/local/bin/sz No such file or directory~~~
如图:Preferences中直接搜索 Triggers
然后 Edit
然后点击 + 号配置即可,注意:Parameters为第3步中脚本的完整路径!!!
instant 也要勾线上~
配置信息从这里复制~~~
Regular expression: \*\*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 # 这个可替换成自己自定义的文件路径
然后,就可以尽情使用了~~~
不放心的话,退出item2重新打开再试~
mac信息:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。