[git] Git on Mac OS X v10.7 (Lion)

I just upgraded my Mac to Mac OS X v10.7 (Lion), and now Git is gone:

$ git
-bash: git: command not found

How can I get Git back?

This question is related to git macos osx-lion

The answer is


You have to find where the Git executable is and then add the folder to the PATH environment variable in file .bash_profile.

Using terminal:

  1. Search for Git:

     sudo find / -name git
    
  2. Edit the .bash_profile file. Add:

     PATH="<Directory of Git>:$PATH"
    

Git is back :-)

Anyway, I suggest you to install Git using MacPorts. In this way you can easily upgrade your Git instance to the newest release.


There are a couple of points to this answer.

Firstly, you don't need to install Xcode. The Git installer works perfectly well. However, if you want to use Git from within Xcode - it expects to find an installation under /usr/local/bin. If you have your own Git installed elsewhere - I've got a script that fixes this.

Second is to do with the path. My Git path used to be kept under /etc/paths.d/ However, a Mac OS X v10.7 (Lion) install overwrites the contents of this folder and the /etc/paths file as well. That's what happened to me and I got the same error. Recreating the path file fixed the problem.


It's part of Xcode. You'll need to reinstall the developer tools.


If you do not want to install Xcode and/or MacPorts/Fink/Homebrew, you could always use the standalone installer: https://sourceforge.net/projects/git-osx-installer/


You can always use MacPorts...


Examples related to git

Does the target directory for a git clone have to match the repo name? Git fatal: protocol 'https' is not supported Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) git clone: Authentication failed for <URL> destination path already exists and is not an empty directory SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 GitLab remote: HTTP Basic: Access denied and fatal Authentication How can I switch to another branch in git? VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio?

Examples related to macos

Problems with installation of Google App Engine SDK for php in OS X dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac Could not install packages due to an EnvironmentError: [Errno 13] How do I install Java on Mac OSX allowing version switching? Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Can't compile C program on a Mac after upgrade to Mojave You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user) How can I install a previous version of Python 3 in macOS using homebrew? Could not install packages due to a "Environment error :[error 13]: permission denied : 'usr/local/bin/f2py'"

Examples related to osx-lion

commands not found on zsh Why does cURL return error "(23) Failed writing body"? What is the "Illegal Instruction: 4" error and why does "-mmacosx-version-min=10.x" fix it? Location of the mongodb database on mac How do I timestamp every ping result? How to run iPhone emulator WITHOUT starting Xcode? configure: error: C compiler cannot create executables sudo: port: command not found Disable elastic scrolling in Safari Completely uninstall PostgreSQL 9.0.4 from Mac OSX Lion?