iorewwb.blogg.se

How install git on mac
How install git on mac













how install git on mac

I'm just not sure.Įver since macOS Sierra, Mojave & Catalina with the most recent Homebrew simply do the following: I've just seen odd things like this before, and it would explain some of these weird cases. If that case is happening where $PATH is correctly loading from /usr/local/bin first but git is still running the /usr/bin/git command, I think this may have to do with Xcode overriding things but somebody else who's more knowledgeable of Xcode can confirm this since I'm not sure. If you do which -a git you'll notice there are multiple versions of git installed assuming you have one installed from XCode (or straight from git) and another installed from homebrew. How do I know if I am using the right git on my system? I checked which git and it shows "/usr/local/bin/git".

How install git on mac mac#

I checked my git version and it was 2.23.0, I did brew install git which should have updated to 2.28.0 I believe however when I restarted my mac and checked git version I still see 2.23.0. Sorry, something went guys, I am having a similar issue. Edit - This could also be related to point about reloading terminal, even for older versions, not sure. I've just seen odd things like this before, and it would explain some of these weird cases (and I know Xcode has things like xcrun to find tools).

  • Add the correct git command to $PATH by adding export PATH=$PATH:/usr/local/bin/git.
  • Set an alias like somebody else said by adding alias git="/usr/local/bin/git" to ~/.bash_aliases.
  • If the above is true and $PATH is correct but git -version is still running the /usr/bin/git command then the quickest and simplest fixes are to either: Btw, macOS sets up the $PATH variable this way by default but if you've changed your $PATH just ensure that /usr/local/bin comes first.

    how install git on mac

    When you run a non-absolute command like git it will search directories in the $PATHenvironment variable and use the first command it finds so you should run echo $PATH and ensure that /usr/local/bin comes before /usr/bin, and if it does then running git should run the correct command for you. You can alternatively confirm by passing -version to each absolute command path to see which is which. The one in /usr/local/bin/git is the one from homebrew which you can confirm with ls -al /usr/local/bin/git and you'll see it's symlinked to the git binary installed in homebrew's Cellar directory. If you do which -a git you'll notice there are multiple versions of git installed assuming you have one installed from XCode (or straight from git) and another that you've just installed from homebrew. For newer versions of macOS, the problem that myself and possibly others experienced is due to simply not restarting the terminal after running brew install git. For details see comment and my comment below it that explains where confusion can happen after installing git with homebrew alongside Xcode's git. However it's unlikely any of this is necessary with newer versions of macOS if you've restarted the terminal after installing git with homebrew.

    how install git on mac

    IMPORTANT EDIT - Any solution I wrote in this comment should be ignored unless you've already done the following: restarted your terminal after running brew install git (important!), ensured which git is returning /usr/local/bin/git and that this is what brew installed, confirmed /usr/local/bin/git -version is displaying the new version installed via brew, and if git -version is still returning the old Xcode version even after restarting your terminal then you can either use simple workarounds to add the path to the proper git install as others and myself mentioned (shown below this edit) or you can use people's solutions above to remove Xcode' git.















    How install git on mac