Non-graphical-user-interface programming?

Discussion in 'Mac Programming' started by aout, Apr 20, 2010.

  1. aout macrumors newbie

    Apr 20, 2010
    I've done a lot of utility programs for Windows that don't need or want a GUI. A few lines of text input and they churn away. On Windows, you do this by invoking the "console", the successor to the MS-DOS screen. Then the Windows API provides routines for clearing the screen, positioning the text cursor, choosing a text color, etc. I can do this with several programming languages; they aren't a problem as long as I have a syntax manual.
    Problem is, my wife bought a Mac. I'd like to convert a lot of these to the Mac, but I need a way to access a non-user-interface screen and access to commands like those I mentioned via a programming language. Can someone help me?
  2. flyingturtle macrumors regular

    Apr 7, 2010
    Since Mac OS is built on Linux, you have a wide variety of command line programming options. If you don't know already, you can access the console via the "terminal" application in your application/utilities folder, or by clicking the magnifying glass icon on the top right of your screen, and then typing "Terminal".

    As for programming language, I'd probably use Python. It's already installed on Macs and it has an interactive shell, which is great for testing out Python code quickly.

    More over Python runs on Windows too. So whatever code you write on your mac, should work on Windows, too (just take careful note of pathing when moving from Unix to Window filesystems "\" versus "/" but you can use os.path. Read more here).

    Ever since learning Python, it's become my all purpose language since it runs both Mac and Windows (and Linux obviously). On top of that I do a lot of Microsoft Dot NET programming (C#, ASP.NET) and I can use Python now as Microsoft adopted Python as one of it's Dot NET languages via IronPython.

    Couple notes: I learned Python first on Windows, which for me was easier to learn as the Python Windows installer came with IDLE -- simple GUI editor. It'll run each of your scripts in it's own shell, so it's a great tool for learning. If you go that route first, be sure to set-up your Environment Path to Python so you can execute Python scripts from any command prompt in windows (this is explain in the Python docs).

    Also I don't know which version of Mac OS you have, but both Leopard and Snow Leopard come with Python. Snow Leopard comes with a newer version than Tiger, which is 2.6. Read this.

    There is a Python 3.0 for both Mac and Windows, but you may want to stick to the Python 2.6.x series for now as most user scripts are made with Python 2.6, plus that is what your mac has a default and if you ever go into Web Application building, the Django Framework, uses only Python 2.6. Plus then you can use Google App Engine later too if you wish.
  3. spatry macrumors newbie


    Sep 4, 2008
    go in spotlight and type "terminal".

    To compile things you need gcc that comes with Xcode. If you want to install other languages like perl, python, ruby etc I suggest you install macports/porticus.
  4. spatry macrumors newbie


    Sep 4, 2008
    ahem... MacOS is built on BSD (mach kernel with bsd like functionality) and Linux is following more or less the System V branch.
  5. flyingturtle macrumors regular

    Apr 7, 2010
    That's right. Thanks I knew that but forgot. I used use BSD previously too (at work).
  6. Alkiera macrumors regular

    Mar 11, 2008
    As others noted, you're looking for the Terminal app, for a command-line interface. If you've used .Net, odds are decent that most command-line apps will run without recompilation using the Mono project. ( System.Console works to manipulate the Terminal screen in the same way it works on Windows Command Prompt, for the most part.

Share This Page