5

I have an old MacBook Pro running High Sierra. Time Machine backs up /Users but not /opt.

The Time Machine preferences let me exclude directories, but does not let me add directories that I want to back up.

How can I get Time Machine to backup /opt on High Sierra and how can I restore it?

6
  • Welcome to Ask Different. That's surprising, because Time Machine backs up all folders, including /opt. What makes you think that /opt isn't getting backed up? If you plug in your Time Machine drive, open the Backups.backupdb folder, open the folder named like your Mac and then the folder with the most recent date, don't you see a subfolder named opt? – jaume Dec 3 '20 at 7:13
  • No, I do not see /opt. I see only /Applications, /Library, /System, /tools and /Users. – Nelson Dec 4 '20 at 20:25
  • 1
    No, I do not see /opt. I see only /Applications, /Library, /System, /tools and /Users. I also do not see /bin, /cores, /dev, /etc/, /private, /sbin, /tmp, /usr, or /var – Nelson Dec 4 '20 at 20:35
  • Yes, I agree, the Finder doesn't display /bin, /cores and other "Unix" folders, giving the (wrong) impression that they are not being backed up, but if you open Terminal, and run ls -l, you will see they are included. Check the screenshots in my answer below. – jaume Dec 5 '20 at 12:11
  • 1
    With a Finder window open, hit Shift-Command-dot and all hidden folders will magically appear and will also appear in the Time Machine recovery windows. Shift-Command-dot also turns it off again. Nevertheless @jaume's answer is correct. – Gilby Dec 8 '20 at 21:46
4

How can I get Time Machine to backup /opt on High Sierra?

You don't need to do anything special to back it up: Time Machine backs up all folders on your Mac.

However, you may get the impression that /opt (and other folders like /bin or /cores, as you mention in your comment) are not included because the Finder hides those folders by default: enter image description here

But don't let the Finder mislead you:

  • either press ShiftCommand. to let the Finder display all folders (press ShiftCommand. again to hide them),
  • or open Terminal, list the contents of the backup folder and you will see that everything is there: enter image description here

How can I restore /opt?

Proceed as follows:

  • Open a Finder window.
  • Enter Time Machine.
  • Press ShiftCommandG and enter / to display the root folder of your drive.
  • Press ShiftCommand. to display hidden folders. You should see /opt now.
  • Browse the timeline on the right-hand side and select the desired date.
  • Select /opt.
  • Press Restore. Note that Time Machine will probably ask whether you want to keep a copy of your current files.
7
  • If TM doesn’t show /opt then how can I restore /opt from backup? – Nelson Dec 6 '20 at 20:56
  • @Nelson You can restore /opt as follows: open a Finder window, enter Time Machine (for example, from the Time Machine icon in the menu bar), press Shift+Command+G and type "/opt" to tell the Finder to display /opt. You can then select single files or directories located inside /opt for recovery. If you wish to restore the whole /opt hierarchy, type "/" instead to open the root directory, select /opt and press Restore. – jaume Dec 6 '20 at 21:28
  • I want to restore the whole /opt directory from the root. If I type / and open the root directory, I cannot see opt or any of the other directories I've named before. – Nelson Dec 8 '20 at 0:53
  • @Nelson You are right, typing "/" doesn't let you recover /opt. I've expanded my answer with information on how to restore /opt: enter Time Machine, press Shift+Command+G and type "/opt", select the desired date, select all folders and press "Restore". Note that Time Machine will probably ask whether you want to keep a copy of your current files. – jaume Dec 8 '20 at 8:04
  • @Nelson: See my expanded answer: You can press Shift-Command-dot to display hidden files in the Finder, that makes restoring /opt much easier than my previous instructions. Could you check it out and report back? – jaume Dec 9 '20 at 6:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .