2

I'm following this guide to install Linux commands onto my OS Terminal: https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/ and I see that the second line tells me to add a line to my .bashrc file, which I have to create since I don't have one. Can anyone explain to me what this does? As well as the PATH command in general?

3

When you run a command in bash (or any other Unix shell), the shell searches for this command in a number of directories. The list of directories is stored in the variable called PATH, paths are separated by :.

The command in question extends the already defined $PATH by two additional paths:

  • /usr/local/bin which is the usual place user-provided commands get installed to
  • The output of $(brew --prefix coreutils)/libexec/gnubin which points to some utility commands required by brew

To see the current value of PATH, run echo $PATH in Terminal.

  • 1
    Additionally, the order : of the directories specified within one's PATH matters. The shell will search for the command according to that order. – njboot May 7 '15 at 7:13
1

A .bashrc file can store and set a number of variables and commands that are executed (run) when you launch bash, which is one of many shells you can use to type commands into the Linux/Unix system.

For comparison, if you prefer the shell zsh then you would create a .zshrc file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .