9

I've installed git in /usr/local on my mac from http://git-scm.com/download/mac but I'm confused about how to open the terminal.

9
  • define open the terminal? from Finder, Go -> Utilities -> Terminal. Make sure that /usr/local/bin (assuming git installed into /usr/local/bin) is in your path. OSX also comes with git, in /usr/bin so you would need to make sure that /usr/local/bin is before that in your path.. Commented Oct 6, 2015 at 15:51
  • Thanks for telling, we've to type the following in the terminal right? sudo mv /usr/bin/git /usr/bin/git-system But it has not mentioned how to make the terminal get out of git-shell? Commented Oct 6, 2015 at 15:53
  • @Doon There's a Git-Shell terminal right..That was what I asking about Commented Oct 6, 2015 at 15:55
  • @Viki You probably just need to type Ctrl-D. Commented Oct 6, 2015 at 15:59
  • @Viki git-shell is a limited shell for ssh accounts that allows the commands required for push/pull to work without having to give full shell access to the computer. I do not think that is what you are looking for (but could be wrong) Commented Oct 6, 2015 at 16:00

5 Answers 5

10

Bash is shell. In mac you already got Bash but in windows you get Bash when you install git. So in mac you will use terminal for your git, but in windows you get separate git terminal. I think that's why you are confused.

when you type

git --version 

if u see it is already installed so you are ready to use the git in your terminal

Sign up to request clarification or add additional context in comments.

Comments

4

I strongly recommend you use Homebrew to install git.

  1. install Homebrew
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. install git last stable version.
    brew install git

  3. open system terminal (the Mac OS build-in terminal)

  4. run git --version, You will see It!

About Homebrew.

4 Comments

This is good advice - especially if you plan to use any other commandline tools, such as ImageMagick, tree, GNU Parallel, gnuplot, doxygen, fswatch...
@ShannonChou Once the built-in terminal changes to the Homebrew's git terminal, how can I revert back to the built-in one?
@Viki The homebrew one will be installed in /usr/local/bin. The Apple-supplied one will be in /usr/bin. So, if you want the homebrew one, use /usr/local/bin/git. If you want the Apple-supplied one, use /usr/bin/git. If you just want to only ever type plain old git, choose once which one you want that to refer to and put that first in your PATH.
@Viki Homebrew and git are not terminals. They are command line tools that you can use in terminal. So, Installing Homebrew and git does not change the terminal. You can use Homebrew to install other command line tools. It's like yum or apt-get in linux. The Mac built-in git is an old version. You won't need it anymore after you installing new one.
4

I use Windows, where Git bash is the application that I use to use git commands. On my mac, however, the Terminal application is used for Git commands like Git Bash on Windows. I was a bit confused as to why I could not find a Git Bash version for Mac anywhere on Git's site. It turns out that Git commands are all executed in the Mac terminal application, Terminal. As said above, first check that you have installed Git correctly with running this in the Terminal:

git --version 

And then if a recent version of git is spat out from the Terminal, then you can start using normal git commands like how one would use in Git Bash, like these:

git clone YOUR_REPOSITORY 

or

git checkout OTHER_BRANCH 

I hope that this helped.

Comments

0

It sounds like you have not performed steps 2 and 3 from the README.txt file:

Step 2 - Remove stubs

In later versions of OS X (Yosemite and onward), you'll probably see a message like the following:

'The "git" command requires the command line developer tools. Would you like to install the tools now?" 

This is because OS X has started to ship with stubs; in order to stay nice and easy-to-uninstall, the git installer places all of it's assets under /usr/local/git. As a result, the git in /usr/local/git/bin/git takes second place to /usr/bin/git.

sudo mv /usr/bin/git /usr/bin/git-system 

Step 3 - Restart bash sessions

This include GNU screen sessions, TMUX sessions, etc. If you wish to preserve your precious screen session, just source /etc/profile.

6 Comments

El capitan (10.11) has SIP enabled so you will not be able to mess with /usr/bin anymore..
@Droppy my question is similiar to this except that we've downloaded from different sources. stackoverflow.com/questions/4725389/… Coming to the README.txt file, I didn't notice any message and also I'm TOTALLY new to this stuff. Please help me out!
But in your question you state you downloaded it from git-scm.com/download/mac. So what gives?
@Droppy as I've said in the previous comment, "my question is similiar to this except that we've downloaded from different sources."
@Droppy Btw MarkSetchell has told that the terminal could be used for both git and normal OS X commands! I think that solves the problem..
|
-2

On your command line, type "git" then cd to the directory where your project resides.

1 Comment

Typing git will just give an error message about usage. It doesn't do anything useful.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.