How to update Git to the latest version

Discussion in 'Mac Apps and Mac App Store' started by zoliky, Nov 30, 2013.

  1. zoliky macrumors newbie

    Joined:
    Jun 8, 2009
    #1
    Hello,
    I use OS X 10.9 Mavericks. I already have git installed, but I didn't install it from the official website. I suppose it comes with XCODE.

    Code:
    $ whereis git
    /usr/bin/git
    
    $ git --version
    git version 1.8.3.4 (Apple Git-47)
    
    The latest git is 1.8.4.3. I would like to download the OS X installer from the official git website, but I would like your suggestions.

    Do I need to uninstall the current git? What is the best way to update to 1.8.4.3?

    Thank you!
     
  2. cbreak macrumors member

    cbreak

    Joined:
    Mar 22, 2008
    #2
    You can easily compile your own git from the official sources. I do that all the time. If you change your $PATH to point to /usr/local/bin first, and compile git with prefix=/usr/local then it won't collide with apple's git.
     
  3. zoliky thread starter macrumors newbie

    Joined:
    Jun 8, 2009
    #3
    If you compile from sources, how do you update it when a new version comes out?
     
  4. localhost8080 macrumors member

    localhost8080

    Joined:
    Jun 18, 2012
    #4
  5. cbreak macrumors member

    cbreak

    Joined:
    Mar 22, 2008
    #5
    I compile a new version and install it over the old.
     
  6. dyn macrumors 68030

    Joined:
    Aug 8, 2009
    Location:
    .nl
    #6
    I downloaded from the website and installed it. No problems. I've now moved on to macports as it is easier to keep it up to date. Also works fine but I've set /opt/local/bin before /usr/bin in my $PATH in order to use the macports version by default. However, I wonder if I still need to do this as I'm not using the very advanced features in git. The system installed one (aka the one that came with Xcode) seems fine for my uses.
     
  7. cbreak macrumors member

    cbreak

    Joined:
    Mar 22, 2008
    #7
    Git gains quite a few nice features, but unless you're reading changelogs you won't know about them anyway, so upgrading bleeding edge is not usually immediately useful.
     
  8. kgs macrumors regular

    Joined:
    Jul 29, 2012
  9. dyn macrumors 68030

    Joined:
    Aug 8, 2009
    Location:
    .nl
    #9
    Don't install homebrew. Its developer doesn't understand how UNIX works and thinks he can own /usr/local completely which isn't true at all. If you install something like gpgtools you will break it because homebrew will put a complete idiotic acl on it (it gives all users full access to /usr/local). Unfortunately, installing homebrew elsewhere usually results in homebrew not working correctly all the time. IIRC they won't even give you support if you installed it somewhere else. As long as these major issues are not resolved homebrew is not to be recommended!

    Also, homebrew uses the existing libraries and such in OS X. This may sound very cool and useful and it is to some extend. There is also a major downside to this because you will have to put up with all the quirks of the OS X installed versions, outdated libraries, tools, etc. It also means that if you screw things up you need to reinstall the entire OS or restore from backup. There are others that don't have these disadvantages (they have others; none is perfect) and, for example, install in their own directory. If something goes wrong you can delete it and start from scratch.

    TL;DR: homebrew has some issues that may b0rk your system. Be sure to read up on what it does, how it works before you even decide to use it!
     
  10. zoliky thread starter macrumors newbie

    Joined:
    Jun 8, 2009
    #10
    I would like to use macports too. How can I set $PATH? Do I need to edit a file?
     
  11. dyn macrumors 68030

    Joined:
    Aug 8, 2009
    Location:
    .nl
    #11
    You can do this manually and there are a few ways of doing that (mostly you set it in the shell config file: .bash_profile, .bashrc, .zshrc, etc.). If you use the Macports installer it will set this automatically though. Check out the Macports documentation for more details on this.
     
  12. zoliky thread starter macrumors newbie

    Joined:
    Jun 8, 2009
    #12
    What do the plus signs mean? [+]doc, [+]pcre
    Are they already enabled by default?
     

    Attached Files:

  13. dyn macrumors 68030

    Joined:
    Aug 8, 2009
    Location:
    .nl
    #13
    Those are variants and they are not enabled by default. Macports and homebrew will download the source, configure it and then compile it. You can set various options and to keep things simple Macports uses this variants system. If you want to have git with only the documentation you'd enter the following:
    Code:
    sudo port install git-core +doc
    It should also work the other way around. This helps if you do not want something like X11 (graphical environment). You could do something like this:
    Code:
    sudo port install wireshark -x11
    . Alternatively you could use +nox11, it does the same thing. If you want to do this as default behaviour for any port you install you should set this in the file /opt/local/etc/macports/variants.conf (it has some examples in it).

    Usually the defaults are fine. You only need to use variants when the default doesn't work because it lacks some feature. Things like documentation can be left out as most software will have it posted on the internet and you can search for it (you get examples from others and such).

    Be sure to check out the Macport documentation regarding variants for more info and some examples: Port Variants.
     

Share This Page