Programs for Coding on Mac?

Discussion in 'Mac Programming' started by Eahdawn, Aug 21, 2012.

  1. Eahdawn macrumors member

    Jul 15, 2012
    Starting college in 3 weeks, and I need to know what programs I need to code on Mac. Will be coding C++ and Java for the first year. Please help!
  2. ohbrilliance macrumors 6502a


    May 15, 2007
    Melbourne, Australia
    There are a lot of options available. XCode is the IDE for Mac development. For more general development Netbeans or Eclipse should both serve you well.

    Another way to go is to code with a good text editor (TextMate, BBEdit, Vim etc) and compile with command line tools. The command line tools can be installed via XCode.
  3. naples98 macrumors member


    Sep 9, 2008
    If you are just learning to program, I would highly recommend a good text editor and compile from the command line. Once you are comfortable with the languages, move onto an IDE (Eclipse, Netbeans, XCode, etc.). The last thing you want is to be learning a language and an IDE at the same time. It gets very confusing, very quickly.
  4. larswik macrumors 68000

    Sep 8, 2006
    For Mac apps or IOS i use xcode. But for HTML, PHP or a great text editor I use It is very feature rich and great to work with.
  5. Cromulent macrumors 603


    Oct 2, 2006
    The Land of Hope and Glory
    It depends. All you really need for C++ is a compiler and a text editor. Likewise for Java you just need the JDK and a text editor.

    Some IDEs are incredibly complex pieces of software that take time to learn. Often for a beginner it is easier to stick with a text editor (Vim, Emacs, BBEdit, Text Wrangler, Textmate are all popular options on the Mac) and the command line as there is less to learn about the tools and you can concentrate on learning the language.

    Some people though do not agree with this position. If you do decide to go with using IDEs then I would recommend Xcode for C++ development and Netbeans for Java development (yes I know that Netbeans can also be used for C++ but I think Xcode does a better job of it).
  6. KnightWRX macrumors Pentium


    Jan 28, 2009
    Quebec, Canada
    Yes, because learning the intricacies of Makefile syntax or gcc command line parameters is much simpler than hitting "Build" in an IDE.

    I got to say the opposite. If just starting out, get an IDE. It'll hide a lot of the ugly details of the actual build process (chaining commands in the proper order to compile and link all the various required files and produce the final executable).

    For Mac, they have already been named : Eclipse, Netbeans, Xcode.
  7. Eahdawn thread starter macrumors member

    Jul 15, 2012

    Thank you very much. It's safe to say you can learn to code C++ and Java from scratch (knowing nothing) on Mac without needing Windows? (I've heard a lot of people say you can't)

    @Knight: You recommend starting learning with an IDE straight up? What exactly is an Integrated Development Environment? What is compared to a "non" IDE?
  8. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    It is perfectly safe to learn C++ and Java on OS X. The languages will not differ at all.

    An IDE is a program/suite of programs that combines a text editor, compiler, debugger, and other tools so you can access everything from one place. The opposite would be to use independent programs for these tasks. There are arguments on both sides, and both are valid. Just pick one and start learning.

  9. KnightWRX macrumors Pentium


    Jan 28, 2009
    Quebec, Canada
    The Integrated Development environment is as its name states, an full set of tools all integrated to work together to do development.

    Let's say you use a text editor and command line tools like is suggested to learn the "language" instead of the "tool". This is what you'll have to go through :

    First, type in the program's code into your text editor and save it :

    #include <stdio.h>
    #include <stdlib.h>
    int main(int argc, char ** argv)
            int i; // There's a reason for this, but this line is mostly useless.
    	printf("Hello World!\n");
    	return EXIT_SUCCESS;
    Next, let's compile it with gcc. Hum, we have to learn a few tricks here, namely GCC's syntax. To compile the program, if we simply type in the following, we might not get what we want :

    $ gcc test.c
    $ ls
    a.out	test.c
    Ok, what is this a.out file ? Well, it's GCC's default name for the executable file. Also, the command line we used is quite suboptimal, since it didn't warn us of anything, like the integer variable named i we defined but did not use. Warnings are important since sometimes they can point to runtime bugs (bugs that happen during execution of a program rather than at its compile time).

    So let's dig deeper. For GCC, it supports the -o switch to change the name of the output file and it supports the -W flags to set the warning level :

    $ gcc -o test -Wall test.c
    test.c: In function 'main':
    test.c:6: warning: unused variable 'i'
    $ ls
    a.out	test	test.c
    Ah, now we got an executable named test and the compiler warned us of our unused variable.

    I could go on with other examples an IDE makes so much simpler, like debugging (learning gdb is quite the feat on its own) using watches and stepping through code and managing breakpoints or just the simple multi-file compilation which is going to result in a lot of typing in commands unless you want to use Makefiles, which requires learning a whole other language to build these Makefiles...

    I personally learned C using a smallish IDE called Turbo C/C++ by Borland, it ran on DOS. We learned the language, all the intricacies of compiling, linking, the pre-precessor and manually loading an executable into a debugger making sure to have a build with symbols intact, etc.. we learned at a high level and only delved into it later when we had written quite a bit of code and learned the language.

    Most college courses will use an IDE so that students can jump straight to code rather than waste time on cryptic command line syntax flags and learning to make build scripts.
  10. psingh01 macrumors 65816

    Apr 19, 2004
    Both are completely independent from Windows or any operating system. When I learned C/C++ and Java it was on Sun Solaris system doing everything via the command line. Just editing text files in a standard editor and running the compiler via the CLI like others have suggested. It lets you focus on learning the language and keeps you from getting confused by the IDE.

    An IDE is basically fancy software that lets you build projects. It includes text editors, compilers and many other tools generally used in software development. It makes it easier to develop software but for simple projects (like you'll be doing as a beginner) you might end up spending more time trying to figure out how to use the IDE instead of how to program in whatever language you are using.

    An example of an IDE is: Xcode on OSX, Visual Studio on Windows, Eclipse on multiple platforms.

    A lot of times beginners get confused with the language that they're learning and the IDE that they're using to develop their programs with. As others I recommend keeping it simple, write code on a text editor and use the command line to compile/run it.
  11. theluggage macrumors 68040

    Jul 29, 2011
    You absolutely don't need Windows to learn C++/Java. The languages themselves are completely system independent.

    I think that the myth might stem from the days of 'Classic' Mac OS which certainly wasn't the best system to learn programming on. That changed completely with OS X which, under the hood, is Unix, and Unix would be the system of choice for many Computer Science departments.

    Where it gets more complicated is when you've learnt enough C++ or Java and you want to start writing programs with 'proper' windows-icons-and-mice user interfaces. Then you're faced with the task of learning the user interface 'API' for your system of choice, which can be as much trouble as learning to program in the first place (and keeps on flippin' well changing every year, too, unlike C++ and Java themselves!). In this case, Windows and Mac are completely different (apart from some underlying common concepts).

    All is not lost, because there are cross-platform user interface libraries that hide the differences from the programmer. Java, in particular, sells itself on cross platform support and comes with graphics and user interface libraries that work on any system. These are pretty much "part of" Java and will likely be covered in any "learn Java" book or course. There are also cross-platform GUIs that can be used with C/C++ but are not so commonplace, or as tightly associated with the language, as Java.

    Programs using Cross-platform GUIs are never quite as slick as ones written specifically for either Mac or Windows - but they get the job done.

    Of course, there are huge swathes of the art of programming work that don't involve Windows desktop apps (e.g. scientific/mathematical computing, systems programming/server applications) and for which the Mac will be just as good as Windows (if not better, because of it's Unix roots). Or, you might want to learn Mac desktop - or iPhone/iPad - programming, although in that case you'd be better off with Objective C rather than C++ (the two are very different).

    However that's the theory - let's temper that with a bit of reality: if you're taking a course at a school/college then you'll probably find it smoother going to use the same system as everybody else (unless they enthusiastically support both Macs and PCs).

    Also, few cross-platform systems are sufficiently reliable that you can assume that anything you write on Mac will run perfectly on Windows- you need to test. The solution to that is to have Windows running in a virtual machine - which is a great solution for 'serious' development but a complication you could do without while learning.

Share This Page