Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Rizzo96

macrumors newbie
Original poster
Jan 2, 2017
2
0
I'm taking a programming course online that uses codeblocks. All my programs have been running fine, but I receive this annoying message at the top of my terminal whenever I run a program. Does anyone know how to get rid of it?

I'm talking about the message thats says at the top "Rizwans-MacBook-Pro:~MacBook$ ... /Debug/InteractiveProgram"

https://puu.sh/t9lkx/7d015f8a30.png

Also, when I open a new terminal window this message pops up

https://puu.sh/t9llv/5a6830108e.png
 
This message is called the "prompt". It currently shows you the name of the machine you're on and the directory you're in ("~ is short for "home"), and the fact that you're logged in as a normal user ("$") as opposed to "root" (which would have a "#" prompt). All this stuff is configurable, but these are the default settings.
 
This message is called the "prompt". It currently shows you the name of the machine you're on and the directory you're in ("~ is short for "home"), and the fact that you're logged in as a normal user ("$") as opposed to "root" (which would have a "#" prompt). All this stuff is configurable, but these are the default settings.
Do you know how I can surpress all of that so when I run my code it won't appear?
 
I'm talking about the message thats says at the top "Rizwans-MacBook-Pro:~MacBook$ ... /Debug/InteractiveProgram"


Also, when I open a new terminal window this message pops up

The title Bar at the top of the window can be changed in Preferences > Profiles > Window > Title. I think default is the working directory or document which is what you are seeing. Try some of the other settings. I suspect this is what you are referring to with the second screenshot as well, but if it is the command prompt "Rizwans MBP...", the command prompt can be manipulated by tinkering with your .bash_profile and\or .bashrc in your home directory. This guy has posted a decent place to start, but every user has his own preferences so you will find thousands of articles on the topic:

https://natelandau.com/my-mac-osx-bash_profile/
 
The Terminal app is essentially a terminal emulator. And a real (hardware) terminal works pretty much like a typewriter. Whatever is "typed" (printed on the screen), stays there.

You need to understand that the prompt isn't "being displayed" on top of your program, or something like that. It has just been printed and now sits there until enough new text is added (printed) and it moves away.

The shell (the command line interface) running in the terminal runs in an infinite loop:
----
1. print the prompt
2. read a command
3. execute that command and print any output
----
Without the prompt the user wouldn't know whether his command is still being executed or if the computer is ready to accept new input. That's why it's necessary.

This is just the nature of working with the terminal. Terminal users don't expect beautiful and tidy graphical interfaces, so don't worry about this.

If you for whatever reason need to clear the screen you can insert enough new lines to get the previous text offscreen. And this is not a dirty hack, that's how it's done.
 
If you for whatever reason need to clear the screen you can insert enough new lines to get the previous text offscreen. And this is not a dirty hack, that's how it's done.
There's a command named 'clear' that clears the window. However, it does this by emitting newlines for the height of the window. That is, you can scroll back and see previous commands and their output.
 
Do you know how I can surpress all of that so when I run my code it won't appear?

It depends what shell you use. I'm guessing bash since it is default. Full documentation here: https://www.gnu.org/software/bash/

Essentially, you're going to modify your PS1 environment variable. Read: https://linuxconfig.org/bash-prompt-basics

There are many ways to tweak/customize your PS1 env var. Read the aforementioned link to set it what you want. There are many reasons why you want your prompt to at least give some indicator on what host your shell is running on.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.