Where do I save my bash aliases?

Discussion in 'Mac Apps and Mac App Store' started by Kalixa, Mar 13, 2008.

  1. Kalixa macrumors member

    Joined:
    Jun 25, 2007
    #1
    I wish to make some aliases for bash such as alias ls="ls -G". The thing is I cannot find the .bashrc where, atleast in Linux, is the place to apply these aliases otherwise the aliases will disapeer when the terminal is closed. So does anyone know how to make these aliases in Mac OS X?

    And as a site note, does anyone know where to place vim commands? In Linux there is also a .vimrc, which I have not been able to locate on my Mac.

    Thanks.
     
  2. TEG macrumors 604

    TEG

    Joined:
    Jan 21, 2002
    Location:
    Langley, Washington
    #2
    I believe that all your environmental variables are stored in you .profile file, including aliases. Look around the home folder using ls -a to locate the hidden /bin and /usr folders and see if they are in there, otherwise, just create the .bashrc file and leave it in your home folder.

    TEG
     
  3. Kalixa thread starter macrumors member

    Joined:
    Jun 25, 2007
    #3
    Creating my own .vimrc seems to work, but creating my own .bashrc and placing my alias into it does not seem to work.
     
  4. Chealion macrumors regular

    Joined:
    Jun 17, 2003
    Location:
    Calgary, Alberta
    #4
    Once you update your .bashrc file you will need to start a new bash prompt. The easiest way is to either just type bash, or open a new Terminal window.

    I know for myself when I set it up in Panther (and it still works in Leopard) I needed to put the following lines into my .bash_proflie file as well.

    Code:
    if [ -f "$HOME/.bashrc" ]; then
      . "$HOME/.bashrc"
    fi
    
    It then came into effect every time I made a new shell.
     
  5. Kalixa thread starter macrumors member

    Joined:
    Jun 25, 2007
    #5
    Nope, still doesn't work. This is how my .bashrc file located in my home folder looks:

    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
    alias ls="ls -G"

    What could be wrong?
     

Share This Page