Where is the .profile file in mac os x lion? – Mac Terminal Trick

If you don’t find the .profile file in Mac OS X Lion, JUST CREATE IT!

.profile file should be located in your home directory. Your home directory is where the terminal opens by default.To see if you have the file or not, type ls -all after opening the terminal. This command will show you all the files including the hidden ones since by default the ls command only shows the visisble files or folders.


If you do not have the .profile file in mac, just create it by simply typing in terminal

vi .profile
This will open a new terminal window where you will be able to edit the file. To save the file in the vi editor do the following:

press the [esc] key
type :wq

The last command will save and close the editor.Now, if you want to edit your .profile file you may type in terminal the following

open /Applications/TextEdit.app .profile

This will open the new .profile file that you created.

Why was I in the need to find the .profile file in Mac OS X Lion?

I was installing grails and I didn’t find the .profile to add the GROOVY_HOME and GRAILS_HOME to the path. By the way I found this great guide to install grails and groovy in Mac OS X. To add them you insert the following lines into the profile file and save:

GROOVY_HOME=/usr/share/groovy; export GROOVY_HOME
PATH=$GROOVY_HOME/bin:$PATH; export PATH

GRAILS_HOME=/usr/share/grails; export GRAILS_HOME
PATH=$GRAILS_HOME/bin:$PATH; export PATH

http://www.128bitstudios.com/2011/03/31/install-groovy-and-grails-on-mac-os-x/

The only issue is that the freaking guide was not explaining how to find or open the .profile file. It has been a long time since I geek again, so I didn’t even know where the home folder was. So the first lesson was that the home folder was the one where the terminal opens by default (duh!!!)

Anyways, since I was not able to find the .profile file in the home folder I was not sure if maybe the OSX Lion mac version would store this file on another place. I didn’t really want to touch any other possible files as I did find another home folder in other directories. As a geek I have learned that is better to be sure almost 100% before messing around.

After like 30 mins I just found out that if you don’t find the freaking .profile file you just create it. The nice thing is that once I created the .profile file I was able to edit it with TextEdit as I showed above and continue with the installation guide for grails and groovy that I provided above. It worked perfectly and I now have grails and groovy installed.

I hope this post gets good organic rank so that next time someone is in the same rush and types in google where to find the .profile file in mac this helps them solve their problem quickly. After querying google many times it was quite difficult.

So if this solved your problem please comment, promote this link or take any action to share it =) Me and other geeks will appreciate it.

Enjoy your new .profile file,

Andrés Díaz

Comments

Trackbacks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>