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.

I have a .bash_profile file that I added some stuff to (aliases and color and some git stuff) and when I open iTerm and source it then everything's fine and I have everything but when I close iTerm and reopen it then no colors and no aliases until I source it again.

What should I do to permanently source it?

Is it maybe sourcing another file? How can I check that?

EDIT: I checked my iTerm preferences, and the "login shell" option is checked so I imagine it should source it when i open iTerm.

share|improve this question
.bash_profile should be sourced automatically. Does it work with Terminal.app? In your iTerm settings, what is the Command being called under Preferences » Profiles » Default » General? –  slhck Mar 28 '13 at 10:18
no command, 'login shell' is checked –  levtatarov Mar 28 '13 at 10:24
HELP? anyone??? –  levtatarov Mar 29 '13 at 9:25
Does it work in Terminal? Have you tried temporarily moving ~/Library/Preferences/com.googlecode.iterm2.plist somewhere else? –  ؘؘؘؘ Apr 16 '13 at 11:21

4 Answers 4

up vote 4 down vote accepted

Ok so i dug deeper into it and it's trying to source .profile and i, instead, had .bash_profile. So i created a ~/.profile file and copied the content of .bash_profile into it, and then - WORKS! it is sourced whenever i start iTerm or Terminal.

share|improve this answer
If both ~/.bash_profile and ~/.profile exist and are readable, bash should only execute ~/.bash_profile (see /usr/share/doc/bash/bash.html). Does ls -l ~/.bash_profile print something like -rw-r--r-- 1 username? –  ؘؘؘؘ Apr 16 '13 at 12:22
Great! It saved my weekend –  Shiplu Jul 29 '13 at 4:18
ls -l ~/.bash_profile prints -rw-r--r--@ 1 username staff ... date . Is the @ a problem? –  Etienne Low-Décarie Jun 26 '14 at 13:22

It's also possible that your terminal shell is defaulting to sh instead of bash. You can verify this first:

 $ echo $SHELL

To change this to bash, you can go into your Terminal -> Preferences -> Startup tab, and change "Shell Opens With:" from "Default login shell" to Command and value "/bin/bash".

Alternately, you can change your default shell by executing the following command at the command prompt:

chsh -s bin/bash

After you do one of these, open a new shell window, and your .bash_profile should be sourced.

share|improve this answer

.profile, .bash_profile and similar files are only sourced by "login" shells. In other words, only when you log in to the system. Therefore it does not make sense to set aliases there.

Keep only environment variables (export commands) in .bash_profile. Use ~/.bashrc for everything else. Source it from .bash_profile too.

share|improve this answer
OS X terminals launch login shells by default. –  slhck Mar 28 '13 at 10:17

I was thinking on .bash_profile then I forgot to login and doesn't work, if you login your .bash_profile will work perfectly.


$ login
$ login: (your name here)
$ password: (your password here)
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.