.profile not loaded (osx lion)

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?


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.


To update, try this: /opt/local/bin/port selfupdate

To run a sudo command like this: sudo port install somePackageYouNeed

Try: sudo /opt/local/bin/port install somePackageYouNeed