Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have mis-configured ~/.profile while adding new environment variable. I want to restore my original .profile for my Mac OS, I am not mac expert please help me. None of my shell command is working for me like ls, java, php etc Please help

share|improve this question
Get it from your backup ? If on Lion what editor did you use as Versions might have it. (For original .profile just delete it) – Mark Sep 9 '11 at 9:48

Show hidden files in Finder. Then you can either fix the problem in TextEdit, or simply remove/rename the file. There is no default ~/.profile on Mac OS X, only a global /etc/profile (and you may also have a ~/.bash_profile).

share|improve this answer

If you still get to the shell prompt, you can use : > ~/.profile to create a new and empty file. Afterwards open a new shell in Terminal (by opening a new tab or window) and your environment should work again.

In addition: When editing .profile (or .bash_profile) it is always helpful to open a shell (terminal window) before you start editing. So even if you mess up the edit, you still have a working shell to fix issues (because .profile is only read once at start so further edits don't impact a running shell unless you source .profile again). And as usual: make backups.

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.