0

I am trying to figure out macOS and want to install Composer which was not a problem....but I need the Laravel and Symfony installer and in the documentation it says that I need to export the variable in .bashrc file.

Normally that file is in /home/username/ directory on Linux

But where is the .bashrc file on the Mac? How to export to the PATH?

2

It should be stored in /Users/username/. To append something to your .bashrc file use

echo foo >> ~/.bashrc

Make sure to use >> and not >, as the latter will overwrite the file.

As @fd0 said, you probably want this in your .bash_profile to make sure it loads. I would append to your .bash_profile like this:

echo "export PATH="$HOME/path/added:$PATH"" >> ~/.bash_profile
6
  • But it is not there. And if I create one and write export PATH there it doesn't have any effect
    – lewis4u
    Jul 29 '17 at 18:53
  • You do not need to use sudo to write to your own .bashrc.
    – fd0
    Jul 29 '17 at 18:54
  • you can use touch ~/.bashrc to create the bashrc file if it doesn't exist. You'll have to use $PATH to reference the correct variable, not just PATH.
    – Gleland
    Jul 29 '17 at 18:57
  • The terminal emulator starts the shell as a login shell. .bashrc will not be read. Use either .bash_login, .bash_profile, or .profile.
    – fd0
    Jul 29 '17 at 19:04
  • where is that .bash_profile file???
    – lewis4u
    Jul 29 '17 at 21:04

You must log in to answer this question.

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