Thursday, January 30, 2025

Installing GFortran in MacPorts after Upgrading MacOS Ventura to MacOS Sequoia 15.3

 Installing GFortran in MacPorts after Upgrading MacOS Ventura to MacOS Sequoia 15.3

I purchased an M4 MacBook Pro laptop to replace my 2019-vintage Intel MacBook Pro.  The older laptop was still working well, aside from running out of disk space, but the prospect of China tariffs motivated an accelerated purchase and upgrade.  The new M4 laptop has actually been waiting a month for my changeover.  I decided to upgrade the older laptop to Sequoia MacOS to facilitate the transfer of files and file structures.  This enables me to perform the dirty work of reviving my computing environments in the context of a familiar keyboard.  

When I tried to compile a Fortran code in Sequoia before upgrading the Fortran installation, the compiler failed because it looked for a directory that exists in Ventura, but does not exist in Sequoia.  So I definitely needed to upgrade everything.

Following the JParkCodes post of May 30, 2023, I tried to selfupdate MacPorts.  logged in as root, I typed

port selfupdate

This command upgraded my MacPort software from 2.10.4 to 2.10.5.  I was also advised by the selfupdate that 

The ports tree has been updated.

65 ports are outdated. Run 'port outdated' for details.

To upgrade your installed ports, you should run

  port upgrade outdated

After trying to upgrade the outdated ports, the software snagged on an update for gcc12.  I believe that this version of gcc is obsolete in Sequoia, and the proper version will be gcc14. 

sudo port install gcc14

This command executed successfully.  I needed to re-run 

  port upgrade outdated

to complete the upgrade.  However, FIRST I need to remove the gcc12 port, because the command hangs on it.

port uninstall gcc12

If an upgrade process hangs, one must kill the associated process in order to uninstall gcc12.  I lwarnewd this the hard way.

Once the gcc14 port is installed, then one must set up the aliases properly to compile Fortran and C programs.  My changes to .cshrc were the lines

alias cc            '/opt/local/bin/gcc-mp-14'

alias gcc           '/opt/local/bin/gcc-mp-14'

alias gfortran      '/opt/local/bin/gfortran-mp-14'



 
Link