Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Command line programming

Command line programming
Thread Tools
Senior User
Join Date: Sep 2000
Location: UK
Status: Offline
Reply With Quote
Sep 14, 2003, 10:25 AM
 
Hi,

Now that I have upgraded to OSX, I'd like to be able to use the terminal to do some simple command line programming. No fancy GUI stuff or complex languages. Essentially, these are my criteria.

1. A common, standard language e.g. BASIC, C...

2. Free

3. Uses command line


Thanks for your help in advance,

David
     
Forum Regular
Join Date: Oct 2001
Location: Sweden
Status: Offline
Reply With Quote
Sep 14, 2003, 10:44 AM
 
ok

1) install Apples developer tools. You probably got the CD when you bought Mac OS X, if not download it from http://connect.apple.com

2) start Project Builder, choose New Project from the File menu. In the list that shows up, select Standard Tool. As the description says "This project builds a command-line tool written in C."

3) Start coding... you will get a Hello world program to start with, and start building from there. Project Builder will help you with syntax checking and debugging and more, but the end result will be a command line based program that you can run in the terminal.

This page will show you: http://cocoadevcentral.com/articles/000054.php
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Sep 14, 2003, 02:47 PM
 
OSX with the developer tools includes everything you need to do command-line programming in C, Objective C, C++, Perl, Python, tcl, and several programmable UNIX shells.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
iMacfan  (op)
Senior User
Join Date: Sep 2000
Location: UK
Status: Offline
Reply With Quote
Sep 14, 2003, 03:12 PM
 
Thanks for the responses. Does anyone know why the site is so slow to download - its currently averaging 2k/sec - very painful for a 300+Mb download!

Thanks,

David
     
Dedicated MacNNer
Join Date: Aug 2001
Location: Socorro, NM
Status: Offline
Reply With Quote
Sep 14, 2003, 04:06 PM
 
If you want to work just with the command line (no project builder) you can (once you install dev tools). Just open a terminal window and use gcc to compile C programs. Just type gcc <filename>, and it will compile whatever is in the file to the program a.out, which you can run from the command line. I normally write the program with something like vi; you can use anything that will make a plain text file. If you want to give the output some other name put -o <filename> right after you type gcc. Here is an example:
%> gcc hello.c
%> ~/a.out
Hello World
%> gcc -o hi hello.c
%> ~/hi
Hello World
%>

Also, g++ works like gcc except that it is a c++ compiler.

I hope that this helps.
-King Rat
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Sep 14, 2003, 04:10 PM
 
Originally posted by iMacfan:
Thanks for the responses. Does anyone know why the site is so slow to download - its currently averaging 2k/sec - very painful for a 300+Mb download!
The developer tools installer may already be on your hard drive. If you haven't finished yet, take a look in /Applications/Installers.

But yeah, Apple's developer download site seems to be getting slower as time goes on.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Forum Regular
Join Date: Oct 2001
Location: Sweden
Status: Offline
Reply With Quote
Sep 14, 2003, 06:23 PM
 
Originally posted by iMacfan:
Does anyone know why the site is so slow to download - its currently averaging 2k/sec - very painful for a 300+Mb download!
Probably because all paying ADC members are downloading betas of Panther and XCode like crazy right now.
     
Mac Elite
Join Date: Jul 2002
Status: Offline
Reply With Quote
Sep 14, 2003, 07:58 PM
 
I've never understood why Apple doesn't use their Akamai connections to do developer distributions. The speed would be so much better that way. You'd think that they'd let their paying customers (and developers to boot) download at reasonable speeds.
     
Junior Member
Join Date: Sep 2000
Status: Offline
Reply With Quote
Sep 17, 2003, 05:28 AM
 
Originally posted by iMacfan:
Hi,

Now that I have upgraded to OSX, I'd like to be able to use the terminal to do some simple command line programming. No fancy GUI stuff or complex languages.
# vi MyClass.java

public class MyClass
{
public static final void main(String args[])
{
System.out.println("Hello World");
}
}

# javac MyClass.java
# java MyClass.java

Hello World


1. A common, standard language e.g. BASIC, C...
Java is pretty standard, and very common across all sorts of platforms.

2. Free
Its built into OSX so no extra charge.

3. Uses command line
All you need is a simple text editor (vi, emacs), and the command line and you can compile, execute and edit.

And your resulting classes will run on any OS!
Nobody made a greater mistake than
he who did nothing because he could only
do a little. Edmund Burke
     
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Sep 19, 2003, 06:33 PM
 
C is also compilable/runnable on pretty much everything.

It really depends on what you want to do, and what you prefer...
[Wevah setPostCount:[Wevah postCount] + 1];
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:09 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2