Hello and welcome back.
In this lecture, I want to show you how you can check to see if your C compiler is installed on your
Mac operating system.
And if it's not installed, you can actually go ahead and install it either by installing Xcode or just
installing the developer tools for the Macintosh operating system.
Now typically if you have your Mac and you do not have Xcode installed, you're not going to have the
developer tools, so you're not going to have your C compiler.
So the first thing you can do is you can check to see if Xcode is installed.
If Xcode is installed, then you're good to go.
You don't need to do anything, so you can go to the finder.
If you double click your finder and you go to applications, you can see if Xcode is installed just
by looking inside here.
If it's not installed, you can go to the App store and you can install Xcode.
That's one option if you want to install that IDE.
If you don't want to install the IDE and you just want to install the developer tools, then you can
actually just install developer tools through the terminal, which I'll show you in a second.
But if you go to the App Store, you can just quickly type in Xcode.
If you go to develop and you can actually probably just scroll down, you're probably see it there and
you can install this IDE.
This ID will allow you to write C programs, but it's not suggested for the class.
So you would just go ahead and install this.
The better way to do it is if you don't want to have too much overhead on your system is you can go
to the app finder, you can go to your utilities folder, double click that and you can select the terminal.
Terminal is your basically your command line interface to your programs.
You could also use the terminal to manually compile your C programs so the command to compile your C
programs and I'll talk about this in later lectures is GCC and in Linux and Unix and Mac, you can type
in which GCC and this will tell you the path of the compiler.
Typically it's installed in USR bin GCC to see if this is installed and working, you can check the
version of it.
So you can type GCC dash dash version and this will tell you if it's installed.
And right now I don't have it installed.
So I get a little box that says if I want to use the compiler, I need to either install Xcode or I
can just install the developer tools.
I'm going to go ahead and say install the developer tools and this will just give me a license agreement.
I'm going to say I agree and this is going to go ahead and try to install the developer tools so that
I can now use the C compiler.
It may take a couple seconds here to install.
After you've finished installing it, it should say that the software is installed.
You can select done.
You can then go back to your terminal window and you can type in which GCC.
Again, this just tells you where it's installed usr bin GCC and then you can try typing in gcc.
Dash dash version.
And this will tell you that it has been configured and that it is installed and so it's using the clang
version of the compiler.
Now you could test this if you wanted to by just creating a document.
You could say VI test Dot C VI is just an editor where you can add some stuff.
If you hit I, you can insert some code.
We don't know anything about C yet, but I'm just going to create a simple C program to test this.
And again, don't worry about the details here.
This is just going to print out Hello world.
But here I just created a sample file for GCC Test.c.
Going to try to compile it, compiled it.
I can run the executable dot slash a dot out and it does.
Hello world.
This is how you can compile and run C programs from the terminal or the command line interface.
We're not going to be doing this too much, but it is an option in the Mac operating system and Linux.
But that's basically all you need to do to install the C compiler for Mac.
Again, it doesn't come pre-installed unless you download the developer tools which I just did, or
you download Xcode.
If you download Xcode and you have it installed on your system, this is the common IDE that Apple uses,
then you should be good to go.
Let me know if you have any questions.
Thank you.