Mac下安装配置rz sz

编程入门 行业动态 更新时间:2024-10-25 00:36:39

<a href=https://www.elefans.com/category/jswz/34/1771250.html style=Mac下安装配置rz sz"/>

Mac下安装配置rz sz

安装iTerm2

  • 建议去官网下载 /
  • 下载好后安装即可

安装rz sz

安装rz sz 前的准备 安装brew

一般我们在linux系统上,会使用软件包管理器yum或者apt,而homebrew简称brew,它的功能类似yum或者apt,它是max osx上的软件包管理工具。

  • 安装homebrew 只需要下面一条语句即可
ruby -e "$(curl -fsSL )"
  • 安装成功后输入 brew 查看是否有提示信息
MacintoshdeMacBook-Pro:~ cmg$ brew
Example usage:brew search [TEXT|/REGEX/]brew info [FORMULA...]brew install FORMULA...brew updatebrew upgrade [FORMULA...]brew uninstall FORMULA...brew list [FORMULA...]Troubleshooting:brew configbrew doctorbrew install --verbose --debug FORMULAContributing:brew create [URL [--no-fetch]]brew edit [FORMULA...]Further help:brew commandsbrew help [COMMAND]man brew
  • 如果看到如上信息,则表示brew安装成功了。

安装 lrzsz

  • 使用如下命令即可
brew install lrzsz

配置rz sz 进行上传下载

  • 进入到. /usr/local/bin 目录下
cd /usr/local/bin
  • 在 /usr/local/bin 目录下需要创建两个文件

创建第一个文件

vim iterm2-recv-zmodem.sh

复制以下内容到 iterm2-recv-zmodem.sh

#!/bin/bash
# Author: Matt Mastracci (matthew@mastracci.com)
# AppleScript from 
# licensed under cc-wiki with attribution required 
# Remainder of script public domainosascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; thenFILE=`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)&\"\")"`
elseFILE=`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)&\"\")"`
fiif [[ $FILE = "" ]]; thenecho Cancelled.# Send ZModem cancelecho -e \\x18\\x18\\x18\\x18\\x18sleep 1echoecho \# Cancelled transfer
elsecd "$FILE"/usr/local/bin/rz -E -e -bsleep 1echoechoecho \# Sent \-\> $FILE
fi

创建第二个文件

vim iterm2-send-zmodem.sh

复制以下内容到 iterm2-send-zmodem.sh

#!/bin/bash
# Author: Matt Mastracci (matthew@mastracci.com)
# AppleScript from 
# licensed under cc-wiki with attribution required 
# Remainder of script public domainosascript -e 'tell application "iTerm2" to version' > /dev/null 2>&1 && NAME=iTerm2 || NAME=iTerm
if [[ $NAME = "iTerm" ]]; thenFILE=`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)&\"\")"`
elseFILE=`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 = "" ]]; thenecho Cancelled.# Send ZModem cancelecho -e \\x18\\x18\\x18\\x18\\x18sleep 1echoecho \# Cancelled transfer
else/usr/local/bin/sz "$FILE" -e -bsleep 1echoecho \# Received $FILE
fi 
  • 将文件写好后保存好,使用如下命令添加权限
chmod 777 iterm2-*

iTerm2 配置添加rz sz 功能

同时按 cmd 和 , 键

  • 点击 iTerm2 的设置界面 Profiles -> Default -> Advanced -> Triggers 的 Edit 按钮
    添加

配置项:

Regular expression   Action        Parameters

**B0100        Run Silent Coprocess  /usr/local/bin/iterm2-send-zmodem.sh

**B00000000000000  Run Silent Coprocess  /usr/local/bin/iterm2-recv-zmodem.sh

  • 点击+号,输入下图内容

    右侧的instant一定要勾选上!!!
    右侧的instant一定要勾选上!!!
    右侧的instant一定要勾选上!!!

点击Close

到此rz sz安装配置就完成了

rz 和 sz 的使用

  • rz 上传功能
    在bash中,也就是iTerm2终端输入rz 就会弹出文件选择框,选择文件 choose 就开始上传,会上传到当前目录。
  • sz 下载功能
    sz fileName(你要下载的文件的名字) 回车。
    会弹出窗体,选择要保存的地方即可。

更多推荐

Mac下安装配置rz sz

本文发布于:2023-07-28 16:29:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1250187.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Mac   rz   sz

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!