Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

free.flyer

macrumors newbie
Original poster
Jun 10, 2021
17
1
I was using rdiff-backup to backup files from my Mac Book Pro 2011 (running High Sierra OS) to my Ububtu server (20.04.5 LTS)...

macrdiff.jpg


This was working sucessfully, until I replaced the Mac Book Pro 2011 with a Mac Book Pro M1 (running Ventura OS).

When I run my backup script, I now get the error "zsh:1: command not found: rdiff-backup"

On the old Mac Book Pro 2011, I had to add the following line to ~/.bashrc...

PATH=/usr/local/bin:$PATH

It seems the new Mac M1 uses zsh now instead of bash and I am not sure whether I need to do something similar ?

What I cant understand is when I SSH from Ubuntu server to the Mac, the rdiff-backup command is found (here it reports the version as 2.0.5)...

ssh_mac.jpg


Yet when I run the backup script from Ubuntu server (which I assume effectively does the same thing) the rdiff-backup command cannot be found...

rdiff_fail.jpg


The Mac has rdiff-backup version 2.0.5 which I installed using Mac ports, the Ubuntu server has rdiff-backup version 2.0.0.

Below is the script (rdiff-macm1-john.sh) I run from Ubuntu server...

Code:
#!/bin/bash

# Use this script to perform a backup of Mac user to the server via SSH
# Source:     /Users/macbookpro
# Destination:    /media/storage/Backup/Mac/macbookpro

rdiff-backup -v9 --print-statistics \
    --exclude-special-files \
    --exclude ignorecase:'**.ini' \
    --exclude ignorecase:'**.DS_Store' \
    --exclude ignorecase:'**\$RECYCLE.BIN' \
    --exclude ignorecase:'**.AppleDouble' \
    --exclude ignorecase:'**.localized' \
    --exclude /Users/macbookpro/Documents/Microsoft\ User\ Data \
    --exclude /Users/macbookpro/Documents/Parallels \
    --exclude /Users/macbookpro/Downloads/svn \
    --include /Users/macbookpro/Desktop \
    --include /Users/macbookpro/Documents \
    --include /Users/macbookpro/Downloads \
    --include /Users/macbookpro/Movies \
    --include /Users/macbookpro/Music \
    --include /Users/macbookpro/Pictures \
    --exclude '**' macbookpro@johns-mbp.fritz.box::/Users/macbookpro \
    /media/storage/Backup/Mac/macbookpro
 
Last edited:

mfram

Contributor
Jan 23, 2010
1,356
406
San Diego, CA USA
Clearly, rdiff-backup is not in the PATH when being executed in the SSH environment when the pull happens. Either read the zsh man pages to figure out which file to use to add the command directory to your path or change the command that is executed via SSH to fully specify the path name of the command. You can use the 'which rdiff-backup' in your interactive shell to figure out the path.

Keep in mind that a SSH pull might not be an "interactive" shell so different files are sourced compared to a login shell.
 
  • Like
Reactions: genexx

free.flyer

macrumors newbie
Original poster
Jun 10, 2021
17
1
Many thanks mfram

I had a suspicion and was hoping it might be something like this, so I tried to fix it but with no luck.

I found the version of rdiff-backup being used by typing the following in terminal...

Code:
which rdiff-backup

and it gave me the following path...

Code:
/opt/local/bin/rdiff-backup

So I created the .zshrc file in $HOME/. and used the path above...

Code:
export PATH="${PATH}:/opt/local/bin"

Then to refresh the profile I used...

Code:
source ~/.zshrc

However, I still get the same error when running the backup script from Ubuntu (i.e. zsh:1: command not found: rdiff-backup)

Initially rdiff-backup was not recognised when I typed it into Mac terminal, so I had to install it.

I first installed rdiff-backup using brew (brew install rdiff-backup), but after installation when I tried to run the rdiff-backup command it was not recognised.

So I then installed rdiff-backup using Mac Ports (sudo port install rdiff-backup.... after installing the Mac Ports package). This took a very long time (20 to 30 min!) and it also installed lots of other packages.

Therefore I currently have the homebrew version of rdiff-backup installed...

Monosnap bin 2022-12-26 18-48-37.png


And the Mac Port version of rdiff-backup installed...

Monosnap bin 2022-12-26 18-48-05.png


PS. I don't like how long it took to install the Mac Ports version of rdiff-backup and all the other packages it installed (makes me nervous). Ideally I would like to remove the Mac Ports version and use the homebrew version, but I dont know how to do this. Though the first step is to get rdiff-backup working from my server !
 

free.flyer

macrumors newbie
Original poster
Jun 10, 2021
17
1
I did try putting the path in the script...

Code:
#!/bin/bash

# Use this script to perform a backup of Mac user to the server via SSH
# Source:     /Users/macbookpro
# Destination:    /media/storage/Backup/Mac/macbookpro

/opt/local/bin/rdiff-backup -v9 --print-statistics \
    --exclude-special-files \
    --exclude ignorecase:'**.ini' \
    --exclude ignorecase:'**.DS_Store' \
    --exclude ignorecase:'**\$RECYCLE.BIN' \
    --exclude ignorecase:'**.AppleDouble' \
    --exclude ignorecase:'**.localized' \
    --exclude /Users/macbookpro/Documents/Microsoft\ User\ Data \
    --exclude /Users/macbookpro/Documents/Parallels \
    --exclude /Users/macbookpro/Downloads/svn \
    --include /Users/macbookpro/Desktop \
    --include /Users/macbookpro/Documents \
    --include /Users/macbookpro/Downloads \
    --include /Users/macbookpro/Movies \
    --include /Users/macbookpro/Music \
    --include /Users/macbookpro/Pictures \
    --exclude '**' macbookpro@johns-mbp.fritz.box::/Users/macbookpro \
    /media/storage/Backup/Mac/macbookpro

But this gave me the following error...

Code:
/home/myserver/.BackupScripts/./rdiff-macm1-john.sh: line 7: /opt/local/bin/rdiff-backup: No such file or directory
 

mfram

Contributor
Jan 23, 2010
1,356
406
San Diego, CA USA
From the picture it appears that "rdiff-backup" might be a symlink. Maybe to rdiff? That might have something to do with it. Maybe copy the executable that is the target to rdiff-backup manually. Or you've got an architecture/library mismatch. That can cause a Unix "command not found" error.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,999
8,887
A sea of green
You can use the file command to tell you what a particular file is.

Examples:
Code:
file /opt/local/bin/rdiff-backup
file /opt/homebrew/bin/rdiff-backup

If you get output you don't understand, you can either post a screenshot of the output, or drag-select the text in the Terminal window and copy/paste it into a reply here.

The file command has a number of options you can use, which it should list when run as:
Code:
file --help
 

free.flyer

macrumors newbie
Original poster
Jun 10, 2021
17
1
You can use the file command to tell you what a particular file is.

Examples:
Code:
file /opt/local/bin/rdiff-backup
file /opt/homebrew/bin/rdiff-backup

If you get output you don't understand, you can either post a screenshot of the output, or drag-select the text in the Terminal window and copy/paste it into a reply here.

The file command has a number of options you can use, which it should list when run as:
Code:
file --help
Thanks chown33, below are the results:

Code:
$ file /opt/local/bin/rdiff-backup
/opt/local/bin/rdiff-backup: a /opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 script text executable, ASCII text

$file /opt/homebrew/bin/rdiff-backup
/opt/homebrew/bin/rdiff-backup: a /opt/homebrew/opt/python@3.10/bin/python3.10 script text executable, ASCII text
 

free.flyer

macrumors newbie
Original poster
Jun 10, 2021
17
1
From the picture it appears that "rdiff-backup" might be a symlink. Maybe to rdiff? That might have something to do with it. Maybe copy the executable that is the target to rdiff-backup manually. Or you've got an architecture/library mismatch. That can cause a Unix "command not found" error.
Thanks mfram, you are correct that the rdiff-backup shown in the screen shot are aliases.

For /opt/local/bin/rdiff-backup the original file is here:

/opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin/rdiff-backup


For /opt/homebrew/bin/rdiff-backup the original file is here:

/opt/homebrew/Cellar/rdiff-backup/2.0.5_2/libexec/rdiff-backup
 

chrfr

macrumors G5
Jul 11, 2009
13,709
7,279
Thanks mfram, you are correct that the rdiff-backup shown in the screen shot are aliases.

For /opt/local/bin/rdiff-backup the original file is here:

/opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin/rdiff-backup


For /opt/homebrew/bin/rdiff-backup the original file is here:

/opt/homebrew/Cellar/rdiff-backup/2.0.5_2/libexec/rdiff-backup
Python stopped being included in macOS at the time 12.3 was released, so you also need to install that, if you haven’t already.
 

free.flyer

macrumors newbie
Original poster
Jun 10, 2021
17
1
Python stopped being included in macOS at the time 12.3 was released, so you also need to install that, if you haven’t already.
Thanks chrfr, Python 3.9.6 is installed.

rdiff-backup works from the Mac terminal, it just does not work when I run the backup script from Ubuntu server (reports 'zsh:1: command not found: rdiff-backup').

But strangely it does work when I manually SSH from Ubuntu to the Mac.
 

free.flyer

macrumors newbie
Original poster
Jun 10, 2021
17
1
At last I got it working !

I created the profile .zshenv with the following path...

Code:
PATH=/opt/local/bin:$PATH

Then refreshed the profile using...

Code:
source ~/.zshenv

and now the rdiff-backup command works.

What a palava !

Thanks all for taking the time to help :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.