Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

after installing mac ports my .profile looks like this:

# MacPorts Installer addition on 2011-12-04_at_20:48:26: adding an appropriate PATH variable for use with MacPorts.

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

# Finished adapting your PATH environment variable for use with MacPorts.

But for some reason when opening the terminal, or connecting to the server remotely (ssh) the .profile is not loaded so I can't use macports (unless i go to the macports folder of course).

How can I activate .profile?

share|improve this question

1 Answer 1

up vote 17 down vote accepted

From man bash (assuming it is your shell, type echo $0 or echo $SHELL at the prompt to find out):

When bash is invoked as an interactive login shell, [...] it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

Make sure you don't have either of the first two files, and if you do, add source .login to them. Alternatively, just add the export line to the preferred file.


Other shells probably have similar mechanics of preferring the shell program specific files to the more generic .profile.

share|improve this answer
1  
Thanks a lot, I didn't realize it would only execute the commands in the first file. Added source .profile in my .bash_profile and it works a lot better! Thanks –  Erik Dec 10 '11 at 18:52
    
.bashrc is another file to add to the list –  Pete Jan 14 '13 at 20:00
    
@Pete .bashrc gets loaded by non-login sessions. A common configuration is to have one loaded by the other though. On OS X, all shells launched by Terminal are login shells by default, different from e.g. common Linux terminal emulators. –  Daniel Beck Jan 14 '13 at 20:12

Your Answer

 
discard

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.