Can't find .profile file in OS X
Solution 1:
There is no ~/.profile
by default.
Some background: when you start your Terminal.app, it loads a shell – in your case Bash. Shells can have configuration files, and .profile
is one of these. They are read when the shell starts up, in a specific order. You can run man bash
and read the section "Invocation" for more details.
Now, under macOS, I would recommend to not create a .profile
file, but a .bash_profile
file instead. For Bash, this will make no difference in functionality. Note however that once you create a file called ~/.bash_profile
, your ~/.profile
will not be read anymore, and since most guides will want you to modify .bash_profile
, it's better to stick to this one.
You can simply create the file if it doesn't exist and open it in a text editor.
touch ~/.bash_profile
open -e !$
Save it, and the next time you start a new instance of Bash (e.g. by opening a new Terminal window), your ~/.bash_profile
will be read and all commands therein will be executed.