How to make OS X to read .bash_profile not .profile file

后端 未结 6 1115
野性不改
野性不改 2020-12-02 06:53

I have read so many suggestions about, not putting your customization aka commands in \".profile\" file. Rather, create a .bash_profile for yourself and add your alias and e

6条回答
  •  既然无缘
    2020-12-02 07:33

    According to the manual page that ships with OS X:

    ... 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. The --noprofile option may be used when the shell is started to inhibit this behavior.

    It should only read ~/.profile as a last resort if neither ~/.bash_profile nor ~/.bash_login are readable.

    On all of my OS X systems, I have my ~/.bash_profile set to:

    if [ -f ~/.bashrc ]; then
        source ~/.bashrc
    fi
    

    It is highly recommended that you do this on OS X in order to get bash to read your ~/.bashrc file like you would expect.

提交回复
热议问题