From the course: Introduction to Fortran

Initial setup: Mac

- Before you can start writing Fortran. There are a couple of pieces of software you'll need to have installed. You'll need a compiler, the program that turns the source code you write into instructions that your computer understands and a text editor to actually write the source code. I'll show you how to get both installed right now. Point your web browser at brew.sh, at the top of the page you'll see this command and a little clipboard. If you click that clipboard, that will copy it to your clipboard. Now open a terminal. You should be able to find that by using spotlight and typing the word terminal, and that will open a terminal for you. Now, you're going to paste that command into the terminal. This will install Homebrew, which is a package manager. Homebrew is how we're going to install a compiler. I've already got Homebrew installed. So I'm not actually going to run this command. Once you have home brew installed type the command "brew install gcc". This will install the gfortran compiler that we'll use for the rest of the course. Once that's installed, go back to your web browser and point it to adam.io. Click the download button to download the Adam text editor. Once that file is finished downloading, execute the installer. Once the installer is completed, it should automatically open Adam for you. Go ahead and close that. Now we can close our finder window and close our web browser and go back to our terminal. Change directories using the CD command. Into a folder that you've created where you can store your programs. Once there, execute the command adam.io to open Adam in the folder that you just created. Once Adam is open, I'm going to split screen the terminal and the editor. Right - Click on the folder that it's opened in and select new file. I'm going to name it "hello_word.f90" the ".f90" means means it's a Fortran file in that file type program space underscore world, hit enter, on the next line type print star comma in quotation marks, hello comma world, exclamation point, enter and then type end program, and then save the file. cmd+s will save, or you can go up to file and save. Now go over to your terminal and type the command gfortran space Hello_world.f90 space -o space hello_world that will compile the source code and create an executable named hello world, now to execute the executable, type the command ./ hello_world It should print hello world to the screen. You should now have all of the software that you'll need installed for completing the course.

Contents