I just got a MacBook Pro and am in the process of trying to get GNU commands installed. I'm following this guide, but I don't know how to do:

Then add the following line to your .bashrc or .zshrc:

export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH"

I did a cd; ls -a and I don't see any files called .bashrc or .zshrc.

Additional Info:
Running Yosemite 10.10.3 on a MacBook Pro. Already have Xcode installed. Total newbie at this.

  • This may sound condescending/patronizing/etc, but that’s not my intent at all. It may come off as such nevertheless, but really it’s not. Bottom line: if you have to ask this question, you shouldn’t be installing brew at all. My advice, though not mutually exclusive, is to learn bash & the unix shell - interactively - then proceed to creating scripts, add formulae, and modifying your working environment as you like. Cheers (from one newbie to another ;) ) – njboot May 13 '15 at 5:27

To know which shell are you using, use the following command:

$ echo $SHELL

It will return something like:

/bin/bash

or

/bin/zsh

After you know the shell, if the file .bashrc or .zshrc doesn't exist in your home directory (echo $HOME to find out), just create it.

If you are using bash, you may have a file called .bash_profile where you can put your export command instead (don't know in zsh).

  • Mine returns to /bin/bash, but I don't have a .bashrc. How and where do I create it? I do remember seeing a .bash_profile somewhere after doing 'ls -a' but I don't remember how I got there – Tommy K Apr 20 '15 at 20:30
  • 2
    @TommyK create it in your user dir, using touch ~/.bashrc – njboot May 13 '15 at 7:39

Create your .bashrc with your text editor & add any files you want. Go to terminal and type in: ls -a It will show some hidden files.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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