Mac – Creating Automatic Period local backup of folder

backuptime-machine

So I want to create automatic backups of my home folder without connecting an external disk. This definitely seems like a feature that the mac should have. I understand that if you have Time Machine set up, then it will make local backups as space permits. Well thats exactly what I want. But you need an external disk in order to activate time machine at all.

I don't have an external disk right now. What I can't understand is why I can't just have it make local backups as space permits without connecting an external drive? Since I don't own an external drive there is no way for me to "turn on" time machine. Does anyone know a way I can?

The best case scenario is that I could select one or a few folders to backup, not the entire file system.

The reason for this is that I am programmer, and I move around a lot, and I'm always working on the command line. Working on code in specific work folders. Code files are generally not huge, and I am not wanting to backup every file on my computer, but only my important files that I've worked on many hours. While I try to be as careful as possible and use version control, sometimes I make a mistake and it would be great to just have a local backup of, say, yesterday's file system, or any recent backup.

Thanks.

Macbook Pro 2018 Mojave

Best Answer

If you want a local backup you can run a bash script that creates an archive of your home directory.

zip -r pathToBackup.zip /Users/username

This can be expanded upon with bash to:

  • Add password protection and encryption with the --encrypt option
  • Run automatically at certain times with cron
  • Append timestamps to name of backup file
  • Keep only a certain number of backups
  • etc...