Lost my .bash_profile. Is it possible to recover it from Time Machine backups?

Solution 1:

You do not even need to enter Time Machine, although your Time Machine drive must be connected and mounted.

In Terminal, which by default opens to your $HOME directory, you can use the following command, literally, to copy the .bash_profile file to your $HOME directory:

cp -av /Volumes/*/Backups.backupdb/*/Latest/*/Users/$USER/.bash_profile .

Note that this command assumes there is only one volume attached that has a Backups.backupdb directory in its root directory.

Solution 2:

In Finder: Set to make visible unvisible files, select your home folder, Enter TimeMachine, select a date before the reinstall, select .bash_profile and restore it.