Installing and using gfortran Fortran on a Mac.
Download Gfortran Macports
So if you're in MATH 190 and you're having a hard time with installing fortran95 or any of the other suggested compilers,don't worry, there is a solution! On every Mac computer, there is a application called terminal that allows you tocommunicate with the computer and get stuff done.OSX does not come with gfortran unless you download the XCode development tools (and even then it's a horribly out of date version). The easiest way to get gcc an gfortran is through MacPorts. The last time I checked though the gfortran version was not 4.4 or greater. Collection of tools and information for scientific computation on Mac OS X including Fortran (g77, g95, HPF), MPI, OpenMP, Cactus, Globus, and RNPL among others.
So first things first, you need to be connected to the internet. Open Terminal, and type the following command
'sudo apt-get install gfortran'
Terminal will then ask a password, enter it and allow the program to install on your computer. This is your compiler;it's called gfortran! If this command doesn't work for some reason, just go to Google search 'gfortran' and you shouldeasily find a link to download it from.
It doesn't have a fancy user interface like SciTE, however it gets the job done. Now that gfortran is installed on yourmachine, you can get to work. But you must learn how to use a text editior first.
Download Gfortran Compiler
The textedit, however appropriately named is pretty useless for witing programs because it insists on saving files as .rtf, which can't be compiled by gfortran.
All Macs come with a few editors, namely: VIM, nano and emacs. To use them, open up terminal again, and type any of the following
'vim'
'nano'
'emacs'
This will open up the text editor inside terminal, where you will code and compile. I find that vim is really easy and effective to use.Most professionals prefer emacs, and nano is very easy, but sometimes too simply made. However, try out all three (look on Google fortutorials on how to use these editors).
Now that you have a compiler and and editor, you have everything you need to write your programs for this class! So, let's write aneasy 'Hello World' program in f95.
In your editor, type the following.
program test
print *, 'Hello World!!'
endprogram
Save this program as hello_world.f95. Now the cool part; we're going to use terminal to compile this code. The following command shouldbe committed to memory. To compile the code type (without the quotes)
'f95 -o test.exe hello_world.f95'
Let's break this command down. The first part addressed the compiler you wish to use, in this case f95 (which comes with gfortran).If you coding in C++ you would put g++ or something instead of f95. The next part '-o' tells f95 to do something. In this case, we're telling f95 to make test.exe out of hello_world.f95. Note, the name of the executable file is irrelevant. I could've named itelephant.exe or hello_world.exe o whatever, you get it.
To recap, address the compiler, command it to do something (with -o), in this case 'test.exe hello_world .f95', we're telling it tomake an executable called test.exe out of hello_world.f95
If you type this correctly, a new line in terminal should appear. This means your code compiled just fine and the .exe file was made.Now you want to run the file! The final command you need to learn is the following (again without the quotes),
'./test.exe'
This simply means, 'Run the executable file, test.exe'. Press enter after typing the command, and the program should run!
Good luck!!
Neill Warrington
Please select a setup package depending on your platform:
NOTE: For older OS'es use older releases. There are releases for many OS version and platforms on the Sourceforge.net page.
NOTE: There are also more recent nightly builds available in the forums or (for Ubuntu users) in the Ubuntu PPA repository. Please note that we consider nightly builds to be stable, usually.
NOTE: We have a Changelog for 20.03, that gives you an overview over the enhancements and fixes we have put in the new release.
NOTE: The default builds are 64 bit (starting with release 20.03). We also provide 32bit builds for convenience.
Windows XP / Vista / 7 / 8.x / 10:
File | Date | Download from |
codeblocks-20.03-setup.exe codeblocks-20.03-setup-nonadmin.exe codeblocks-20.03-nosetup.zip codeblocks-20.03mingw-setup.exe codeblocks-20.03mingw-nosetup.zip codeblocks-20.03-32bit-setup.exe codeblocks-20.03-32bit-setup-nonadmin.exe codeblocks-20.03-32bit-nosetup.zip codeblocks-20.03mingw-32bit-setup.exe codeblocks-20.03mingw-32bit-nosetup.zip | 29 Mar 2020 29 Mar 2020 29 Mar 2020 29 Mar 2020 29 Mar 2020 02 Apr 2020 02 Apr 2020 02 Apr 2020 02 Apr 2020 02 Apr 2020 | FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net |
NOTE: The codeblocks-20.03-setup.exe file includes Code::Blocks with all plugins. The codeblocks-20.03-setup-nonadmin.exe file is provided for convenience to users that do not have administrator rights on their machine(s).
NOTE: The codeblocks-20.03mingw-setup.exe file includes additionally the GCC/G++/GFortran compiler and GDB debugger from MinGW-W64 project (version 8.1.0, 32/64 bit, SEH).
NOTE: The codeblocks-20.03(mingw)-nosetup.zip files are provided for convenience to users that are allergic against installers. However, it will not allow to select plugins / features to install (it includes everything) and not create any menu shortcuts. For the 'installation' you are on your own.
If unsure, please use codeblocks-20.03mingw-setup.exe!
Gfortran Mac Download
Linux 32 and 64-bit:
Gfortran Download Windows
Distro | File | Date | Download from |
codeblocks_20.03_amd64_oldstable.tar.xz codeblocks_20.03_i386_oldstable.tar.xz codeblocks_20.03_amd64_stable.tar.xz codeblocks_20.03_i386_stable.tar.xz | 29 Mar 2020 29 Mar 2020 29 Mar 2020 29 Mar 2020 | FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net FossHUB or Sourceforge.net | |
codeblocks-20.03-1.el6.rmps.tar codeblocks-20.03-1.el7.rmps.tar | 29 Mar 2020 29 Mar 2020 | FossHUB or Sourceforge.net FossHUB or Sourceforge.net | |
For Ubuntu, use this PPA: | 29 Mar 2020 |
Note: The Linux packages above are compressed archives (tar, tar.xz or tar.bz2). When you decompress the package you downloaded on your system, you will find all the .rpm or .deb packages required to install Code::Blocks.
Note: On RedHat/CentOS older revisions of 6 (up to 6.2 as far as we know) you need to add repoforge (former rpmforge) to your repolist, to be able to install the needed wxGTK-package. See http://repoforge.org/use for an instruction.
Note: Redhat/CentOS probably also needs an installed hunspell-package, if you want to install the contrib-plugins.
Mac OS X:
File | Date | Download from |
CodeBlocks-13.12-mac.zip | 26 Dec 2013 | FossHUB or Sourceforge.net |
NOTES:
- Code::Blocks 20.03 for Mac is currently not available due to issues caused by Apple hardening their install packages and lack of Mac developers. We could use an extra Mac developer to work on these issues.
- The provided download contains an Application Bundle (for the i386 architecture) built for Mac OS X 10.6 (and later), bundling most Code::Blocks plugins.
For older release versions please check here.