GNU indent for OSX

Discussion in 'Mac Programming' started by Harun, Nov 9, 2008.

  1. Harun macrumors member

    Sep 6, 2007
    I am new to programming on OSX but not new to programming. I needed GNU indent for a project. The version of indent that ships with OSX wasn't what I was used to. I downloaded GNU's version and after a few hiccups got the build to work. You can download the fixed version that will build from source here:

    To build it you need the GNU compiler that Apple provides in the XCode download. If you have all that taken care of, unpack the archive, go in to that directory and do this:

    $ autoconf
    $ ./configure
    $ make
    $ sudo make install

    You will still have the systems old indent in "/usr/bin/indent/". The new one you just built will be in "/usr/local/bin/indent/". You can resolve this however you wish. I just added the line:

    alias indent="/usr/local/bin/indent"

    To my .bash_profile.

  2. netytan macrumors 6502


    May 23, 2004
    Thanks Harun, this is exactly what I was looking for! Have you tried getting your changes merged back into the official code base?
  3. kocoman macrumors regular

    Dec 26, 2007
    Has anyone tried this in mountain lion and Xcode 4.5.1?

  4. robvas macrumors 68030

    Mar 29, 2009
    Have you looked at Homebrew?

    If you install it, you can type 'brew install gnu-indent' and it will give you version 2.2.10
  5. balamw Moderator


    Staff Member

    Aug 16, 2005
    New England

Share This Page