41

Possible Duplicate:
git: command not found

how do I add /usr/local/git/bin/ to the PATH on mac osx? I just installed git but it is not recognizing commands. It only responds with "command git not found", and I believe this may be the solution but I do not know how to add it to the path to be used in terminal.

Community
  • 1
  • 1
Christian
  • 1,685
  • 9
  • 28
  • 48

1 Answers1

115

You can add the following to ~/.bash_profile:

export PATH=/usr/local/git/bin:$PATH

The change will get applied with the next terminal window you open.

dearlbry
  • 3,193
  • 2
  • 23
  • 23
  • Thank you. How do i add that to the ~/.bash_profile? does it already exist? or is it a file I have to create? – Christian Apr 05 '11 at 00:16
  • 3
    You can create it if it doesn't exist, but it should be there already. Open up Terminal (Applications/Utilities), and type `/Applications/TextEdit.app/Contents/MacOS/TextEdit ~/.bash_profile`. The file is hidden (because it starts with a .), which is why you can't open it using the File/Open menu by default. – dearlbry Apr 05 '11 at 02:25
  • 6
    ~\.bash_profile can easily not exist. If it does not exist you should create it as a normal text file. And fyi, on OSX ~\ means the users home folder. – whitneyland Jun 26 '13 at 16:38
  • 3
    you can also run this directly in command-line `export PATH=/usr/local/git/bin:$PATH` – Muhammad Mar 02 '15 at 19:20
  • You can also just run `source ~/.bash_profile` so you don't have to restart your terminal window. – Melvic Ybanez Sep 05 '16 at 15:22
  • add `"git.path": "/usr/local/bin/git"` in `settings.json` – Hamza Waleed Jan 15 '20 at 07:14