git_osx_installer
git_osx_installer copied to clipboard
system git takes precedence on OS X 10.11
I have successfully installed git in /usr/local/bin, but the system git (/usr/bin/git) is taking precedence on OS X 10.11.6. The README says this will not happen on 10.11, but it does. The suggested solution of 'sudo mv /usr/bin/git /usr/bin/git-system' merely results in 'mv: rename git to git-system: Operation not permitted'. Yes, even with the sudo. Root is not currently enabled, as is the Apple default - is that the only solution to this?
I was having the same problem. This is due to apple's uber secure environment. Someone suggested to disable the security temporarily and then try. Another approach (which I did) was added the following to my bash profile export PATH="/usr/local/bin:$PATH"
. Now the proper version of git is used (and not apple's)
Thanks. The solution I went with was to alias git to /usr/local/bin/git, which works fine and is less radical than putting all local/bin executables first in the path. (I doubt there's anything wrong with the latter approach, but it could cause some unexpected behavior.)
note: OSX 'which' is broken, because it doesn't show the one actually being used. if you try to execute git
it actually uses /usr/bin/git
but which
claims the system should be using the git that is part of this package...
$ which git
/usr/local/bin/git
I have got to resolve the issue by adding export PATH="/usr/local/bin:$PATH"
to my bash profile. Thanks to @imranzahid01 !
Here are the steps to do this:
- Open the terminal
- Type
nano .bash_profile
to open the bash_profile in nano (a terminal editor) - Copy/Paste this code
export PATH="/usr/local/bin:$PATH"
- Exit and Save the bash_profile:
alt + X
, type `yes' to save file change. - Refresh the bash shell environment:
source ~/.bash_profile
@jeanniton-mnr thanks been pulling my hair (haven't got a lot to spare !) out for last couple of days trying to set-up environment on my mac to aid learning Python. Just couldn't install latest version of GIT no matter what I tried until I read your post. Don't profess to understand any of it but to cut long story short when I now type git --version at command line I get 2.17.0 rather than 2.11.0 like before ! . Am starting 'Learn Python the Hard Way' and it also told me to install Atom and Visual Code Studio, Atom works ok but again couldn't get VCS to load-up / work , wondering if I should even bother trying to do so ? I also installed Homebrew to try and sort out updating GIT before coming across your solution and don't know if it will be any use for me in future ? Am a bit wary as installed all these programs via command line and mindful that I'm not au-fait if could 'compromise' my system :(
Hi! I have the same issue with the system taking precedence so I tried both @imranzahid01 's way to (momentarily) solve the issue and @dsyphers alias approach as well, but every time I restart the Terminal I have to re-enter the commands. Is there a way to fix it for good?
I edited /etc/paths to put /usr/local/git/bin at the top. That way I didn't have to override the /usr/bin versus /user/local/bin precedence to use the git at /user/local/bin/git instead of the bogus system version of git at /usr/bin/git.
With my git installation the git executables in /usr/local/bin are symlinks to executables in ../git/bin (/usr/local/git/bin).
My /etc/paths goes directly to the git executables instead of through the symlinks. Not sure if that will be a problem but I'm going with it for now.
I have got to resolve the issue by adding
export PATH="/usr/local/bin:$PATH"
to my bash profile. Thanks to @imranzahid01 !Here are the steps to do this:
- Open the terminal
- Type
nano .bash_profile
to open the bash_profile in nano (a terminal editor)- Copy/Paste this code
export PATH="/usr/local/bin:$PATH"
- Exit and Save the bash_profile:
alt + X
, type `yes' to save file change.- Refresh the bash shell environment:
source ~/.bash_profile
Hi,
I tried this approach but it doesn't work in my computer. I have Mac OS Big Sur 11.4. Does it need a different approach? I installed Git version 2.31.0 and I am unable to link GitHub and Git, OR, I am not sure if they are linked. I also tried the Readme file's approach that asks to run this code: "sudo mv /usr/bin/git /usr/bin/git-system" ... but for whatever reason, something is not working. Please suggest some other way to configure.
Thanks
how do you uninstall this git after using your steps @jeanniton-mnr? now I have git on Mac osx with homebrew and its overriding and don't want it to be redundant
@ricardoaball There is an uninstall bash script in /usr/local/git directory