MacOS – How to Recover Old Version of File in El Capitan without Backups

macosrestore

I know there are many softwares about recovering deleted files. I did not have version control in order in one system, and the file was replaced by an empty file.

I would like to understand if there is any chances of restoring the file. It is .tex file of some hundreds of lines.
I had it in BitTorrentSync but it does not store old versions.
This complication was caused either by TextMate 2beta when running compilation in non-TeX document; BitTorrentSync (has been unstable in 2.x but weak evidence). The file got empty with 50kB total size as a complication.

In the compilation, I had in place the option --shell-escape with XeLaTeX which allows to run Python inside LaTeX document.

View

In TextMate, you see the corrupted file

enter image description here

In doing vim file.tex, I see corrupted file

Last login: Wed Apr  6 21:41:50 on ttys000

MacBook-Air-3:~ masi$ vim   /Users/masi/BitTorrentSync/diseases/1.4.2016.tex 

Clinical infectious disease - David Sch...
Mandel    

Herpes virus infection % = Herpesviridae
\begin{itemize}
"~/BitTorrentSync/InfectiousDiseases/1.4.2016.tex" 1909L, 50380C

which indicates that something has went very bad wrong, most probably in the compilation of TextMate.


How to Restore an Old Version of a File in El Capitan?

Best Answer

No success in restoring the file, like patrix points out. So regular daily backups is the way to go to prevent loss of data. However, this cannot only be the measure in the long-run. We need to understand why such an occasion occurs.

Suggestion for improvements in Text Editor, Python and LaTeX

I think the reason for the corruption of the file was the shebang --shell-escape inside TextMate but also because of LaTeX community. There are many other tickets in TextMate which should be fixed so this one is not in the high list. So I just do not use "always" the shebang for Python because of the danger of losing data. We should

  • understand how to limit the rights of --shell-escape
  • understand how to have Python in inside LaTeX without full shell rights
  • much more error tests are needed for tracking down this error
  • active text editor development with open/community development

I think this is not only the editor' fault. I think this is also LaTeX community task because they allow in the first place python in the .tex document with too wide permissions. I think the current method should be better implemented because of such damages. I think we need pythonLatex or something else because importing whole python in LaTeX is dangerous currently without Unit tests.

  • I propose Unit tests for LaTeX documents. This could help me to understand between the integration with Python and LaTeX, and with text editor