Skip to content

Instantly share code, notes, and snippets.

@meowoodie
Created October 8, 2015 10:43
Show Gist options
  • Save meowoodie/4bcf6d6ae81727b618bf to your computer and use it in GitHub Desktop.
Save meowoodie/4bcf6d6ae81727b618bf to your computer and use it in GitHub Desktop.

Set rz and sz on Mac

There are a mess of troubles in sending and receiving files from my macbook to dev server, since I had no permission to excute command scp on dev server. Here is a lightweight, quick, and convenience tools which related with ssh, called lrzsz. lrzsz is a unix communication package providing the XMODEM, YMODEM, ZMODEM file transefer protocol which usually has been already installed in most of servers.

Prerequisites

  • iTerm2 is necessary. Here is the official website.
  • Install lrzsz on your mac:
sudo brew install lrzsz

Set trigger for iTerm2

  • First you should download the scripts from ZModem integration for iTerm 2, and save them in /usr/local/bin/
  • Set up two triggers in iTerm2's [preference] -> [profile] -> [advanced] -> [triggers] -> [edit]
	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

How to use it

rz

  • Run "rz" on dev server. Then it would prompt that something like "rz waiting to receive." and create a new window titled "choose a file to send".
  • Choose the file you need to receive from your laptop.

sz

  • run "sz /path/file" to send server's file to your laptop.
@justinlawrence
Copy link

Current versions of lrzsz installed by brew install lrzszwill install to /opt/homebrew/bin/ So make sure to change /usr/local/bin to /opt/homebrew/bin/ in the send/receive scripts linked above

Thanks @J00MZ, this helped me!

@justinlawrence
Copy link

It would be helpful to add one more step to the instructions:

chmod +x /usr/local/bin/iterm*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment