Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I accidentally did this:

command > ~/.bash_profile

Instead of

command >> ~/.bash_profile

I know, I'm an idiot. Is there a way to recover the old .bash_profile file?

Thanks a lot for your help

PS: The machine is a macbook pro with Leopard.

share|improve this question
Lesson learned : ALWAYS , no matter what are you editing, do a backup first –  Luciano Facchinelli Aug 18 '11 at 18:00
It's not about backing up data, it was a typo on the command –  Pablo Fernandez Aug 18 '11 at 18:51
Thats a secondary thing... you edited bash_profile anyway –  Luciano Facchinelli Aug 18 '11 at 18:53

2 Answers 2

Unless you had Time Machine or some other backup of the file, it's gone.

If that was the original .bash_profile, according to this page, the default setup for users is stored in /System/Library/User Template/English.lproj, you should be able to get another copy of the original from there. Or just create a new user and take theirs.

share|improve this answer

It's possible but unlikely. The effort involved in recovering it will most likely be harder than simply rewriting it or recovering it from a backup.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.