Benches macOS

8

Equivalent of .bashrc?

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

What is the unix equivalent of the linux .bashrc file? I am looking to set some variables at launch... thanks in advance

8 replies

Sign in or join Beachball Help to reply.

  1. 0

    Bill Scott

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    It is called .bashrc

    I think the problem you are running into is that bash either reads .bashrc or it reads .bash_profile.

    You can create a .bash_profile file and put the line

    source ~/.bashrc

    in it, and then you have all the bases covered.

    Another option is to use zsh.

  2. 0

    Gary Kerbaugh

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hi Daniel,

    Zsh has been around for a while so I don't know how fresh it is but it hardly stinks up the place either. I think zsh is by far the most amazing shell ever. I've been using it for years and the rate at which I discover new amazing things about zsh never seems to decrease.

    Bill Scott has a rather amazing web site on
    zsh on OS X. He has quite a "battery" of shell startup scripts for zsh. I have some myself and Bill has a link to mine on his site. However, he started with mine and went
    way beyond, developing quite a lot of stuff that is specific for OS X. I think that most of the people that we've gotten to try zsh have never looked back so I hope that you have the same experience and enjoy it as much as we do!

    --

    Gary

    ~~~~

    Lead me not into temptation... I can find it myself.

  3. 0

    Gary Kerbaugh

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hi Daniel,

    Yes, you can execute:

    chsh /bin/zsh

    Then your shell will be zsh. You can follow the instruction on Bill's website in order to setup his startup scripts for zsh.

    If you use my startup scripts, at
    zsh.tar.gz, download the tarball to your home directory and unpack it with the command:

    tar -zxvf zsh.tar.gz

    it will place them in a ~/Library/init/zsh directory so they shouldn't overwrite anyone's files. You may then activate them with a command like:

    echo "source ~/Library/init/zsh/zshrc" >> ~/.zshrc

    After that, the next terminal window you open will have a configured zsh as the shell. You can use it just like bash. The differences in syntax between zsh and bash are only evident in relatively complex commands.

    The main difference that you'll notice in the beginning is the fact that you can complete just about anything you can imagine. Zsh not only completes file names but it completes most parts of a command. It knows what is required for various arguments to commands. All you have to do is to hit the <Tab> key. If there is more than one possible completion, zsh will list the possibilities. If you hit the tab key more times, zsh will cycle through the possibilities. Just stop hitting the <Tab> key when you see the one you like. Enjoy!

    --

    Gary

    ~~~~

    MSDOS is not dead, it just smells that way.

    -- Henry Spencer

  4. 0

    daniel lemke

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I see, i have a .profile file here, and that looks like the one i need.

  5. 0

    daniel lemke

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I see, i have a .profile file here, and that looks like the one i need.

  6. 0

    daniel lemke

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    zsh looks fresh, i will have to check that out too! thanks for the heads up.

  7. 0

    Bill Scott

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Either will work. .bash_profile I think is specific to bash, but .profile gets read by sh and ksh too.

  8. 0

    daniel lemke

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    So i can replace my current bash with zsh? It is an entirely separate animal?