Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have bash-completion installed using macports and following lines in my .bash_profile

if [ -f /opt/local/etc/bash_completion ]; then
    . /opt/local/etc/bash_completion

but the completion doesn't work when I open Terminal, however it starts working after sourcing .bash_profile or after 'bash -l'.

I'm running OSX 10.6, in Terminal preferences there is "Shell opens with: Default login shell (/usr/bin/login)" selected.

Solved: What I missed is line in How to use bash-completion

Make sure you add this after any PATH manipulation as otherwise the bash-completion will not work correctly.

when I moved the lines after PATH manipulation everything works fine.

share|improve this question

I'd use the chsh command to make sure your shell is actually Bash; if your shell is /bin/sh instead of /bin/bash, Bash will mimic a historical shell, and won't read ~/.bash_profile.

From man bash:

If bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well. When invoked as an interactive login shell, or a non-interactive shell with the --login option, it first attempts to read and execute commands from /etc/profile and ~/.profile, in that order.


Since a shell invoked as sh does not attempt to read and execute commands from any other startup files, the --rcfile option has no effect.

share|improve this answer
The account's default shell can be changed in System Preferences » Accounts » Right-click your entry » Advanced…. It's /bin/bash by default. – Daniel Beck Apr 1 '11 at 5:52
My shell is '/bin/bash' and the '~/.bash_profile' is read, everything (aliases, prompt) but bash completion works fine. – liborw Apr 1 '11 at 7:23
@Daniel: Thanks, I wasn't sure if the default shell had changed since 10.4. @liborw: Can you make your full ~/.bash_profile available? Editing the information from your last comment into the original post would be helpful as well. – kate Apr 1 '11 at 19:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .