0

Executing . .bash_profile (or source ~/.bash_profile) doesn't seem to do anything. (.bash_profile below; I don't see the echo "bash profile end" in the terminal). However, if I copy-paste lines from .bash_profile, they work.

I'm running an interactive login shell, have tried restarting but now am at a loss to understand . .bash_profile doesn't return anything. (additionally, when I open a new terminal, .bash_profile isn't sourced, but it was a couple of hours ago). Any help would be most appreciated.

Mac OS Sierra. SHELL: /bin/bash/ PATH: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin

# Colors and styles
# export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1 
export LSCOLORS=ExFxBxDxCxegedabagacad 
alias ls='ls -GFh'
# -G == colorize output, -h size human readable, -F {/ after directory, * after executable, @ after symlink}

# Move homebrew's usr/local/bin ahead of /usr/bin
# export PATH=/usr/local/bin:/usr/local/sbin:~/bin:$PATH

# Add homebrew directory
export PATH=/usr/local/bin:/usr/local/sbin:$PATH

# virtualenvwrapper
export WORKON_HOME=~/.envs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/Cellar/python3/3.6.2/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
source /usr/local/bin/virtualenvwrapper.sh

echo "bash profile end"
  • What are the permissions on .bash_profile? – Hunter.S.Thompson Jul 18 '17 at 9:13
  • they were 644, I've just tried 777 and that didn't help either – Liz Jul 18 '17 at 9:15
  • Is your .bashrc sourcing your .bash_profile? Iirc the mac terminal doesn't start as a login shell but I forget the rule about which is sourced automatically when as I'm sourcing my .bash_profile under Linux. I recall doing the same when I ran OS X. – Cory T Jul 18 '17 at 9:27
  • I don't seem to have a .bashrc, so no. – Liz Jul 18 '17 at 9:31
  • Try creating one and have it source your .bash_profile. If the .bashrc is missing then bash will use the system's copy (/etc/bashrc). – Cory T Jul 18 '17 at 9:36
0

~/.bash_profile is executed only when a login shell starts.

~/.bashrc is executed when a non-login interactive shell is run.

To have commands executed when you open a new Terminal, you must put them in ~/.bashrc.

  • I'm running an interactive login shell :) – Liz Jul 18 '17 at 10:26
  • 1
    This is true in general, but the OSX terminal runs a login shell (by default at least and most people don't change the default). – Gilles Jul 19 '17 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.