Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am using a Macbook Air. I used system("cls"); and system("clear").

That would not work. It displays on the output screen (xcode output screen) that the command cannot be found. I am using the C compiler, not C++.

How do I clear the output screen on Xcode? Please guide me through the steps in doing this.

share|improve this question
This is a question more suitable for one of the programmers stack exchanges. –  hotpaw2 Nov 22 '12 at 2:51
What do you mean by output screen, the console in Xcode or a Terminal ? –  Mark Nov 22 '12 at 9:36
The current version of Xcode (4.5.2) has an organizer window and project windows. Which of these do you consider to be the "output screen" - feel free to edit the main question and people will see your change rather than replying in comments... –  bmike Nov 22 '12 at 13:40
Output screen = Console screen –  Eugene Jan 3 '13 at 4:05
add comment

2 Answers

I'm not sure I entirely follow you, however; if you are using X-Code to compile and run C programs, output (e.g. any printf statements) should automatically be sent to the console, like so:

int main(int argc, const char * argv[])
   printf("Test program\n");
   return 0;

Is this the 'screen' you want to clear? If so, simply building and running any program which has no console output will do so (although I'd be interested to know why you need this.)

In the example above, comment out the line with the printf statement and build and run. You'll get a clear console.

share|improve this answer
I would just like to clear the output screen on Xcode. And yes, just a simple printf example is okay. Could you also tell me how I can display the output screen on Terminal? –  Eugene Nov 27 '12 at 23:37
I use system("cls"); at school and it works fine but it does not clear the screen. Instead, it says it is not a function or it cannot be found. –  Eugene Nov 27 '12 at 23:39
I used printf("Hello World!\n"); then the line after that system("clear"); then in bold letters it displays "TERM environment variable not set." What does that mean? –  Eugene Nov 27 '12 at 23:59
Redirecting console output to the terminal is not something I've ever had call to do. However, according to an answer on [stackoverflow.com/questions/1910177/… it is possible. –  Robert Nov 28 '12 at 9:00
add comment
up vote 1 down vote accepted

It seems as though it is not possible to clear the output screen with any function on Xcode. I installed Visual Studio 6 on my Windows XP and the system("cls"); function works. Thank you everyone for helping me with this issue.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.