Apple - How to restore a hidden file in Time Machine?
Rest assured that Time Machine is backing up your dot-files! You just can't see them by default in Finder. In order to restore a hidden file like .zshrc
you first need to turn off file hiding in finder. You can do this by opening a Terminal window and entering:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
Now enter Time Machine and navigate to where your hidden files resided. You should be able to restore them from there.
When you've restored all the files you want you can go back to having Finder hide them by entering:
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder
in a Terminal window.
The AppleShowAllFiles pref seems to be gone in High Sierra.
Fortunately, you can now (in Sierra and High Sierra) tell Finder to show you all your "hidden" (dot) files with:
shift ⇧ + cmd ⌘ + .
This works in Time Machine as well.
You can easily access to your hidden file by using the Terminal.
cd /Volumes/TIME_CAPSULE_DISK_NAME/Backups.backupdb/YOUR_BACKUP/Users/YOUR_NAME
ls -la