Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Compiling WRF on iMac

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.


New member
Dear WRF users,

I am trying to install WRF on my iMac.

After ./compile em_real, no .exe files generated.

In the log, there was a message;
read_grib.c:48:10: fatal error: '/usr/include/time.h' file not found

Threfore, I deleted following line in external/io_grib1/grib1_util/read_grib.c.
#include <time.h>

Again after ./compile em_real, no .exe files generated.

The versions are as follows.
- WRF 3.2.1
- macOS 10.15.4
- gfortran 9.3.0
- gcc 11.0.3
- netCDF 4.7.4
- MPICH 3.1.4
- zlib 1.2.7
- libpng 1.2.50
- JasPer 1.900.1

Is there any solution to compile?
Any help will be really appreciated.
Many thanks in advance.


  • configure.wrf
    19 KB · Views: 45
  • log_default.txt
    682.3 KB · Views: 42
  • log_deleted_time_h.txt
    682.3 KB · Views: 50
The errors that we are mostly interested in are "Error" with a capital 'E.' You should be able to get those if you ask that the standard error and output is sent to the log file during compilation. I would recommend following these steps (don't delete any of the files):

./clean -a
./compile em_real >& log.compile

You can then send me the new configure.wrf and log.compile file.

A likely problem is that this version of WRF is SO old, and it's nearly impossible to compile really old code with newer compilers. Additionally, code that old is very outdated with numerous bugs that have been corrected over the years, so we don't recommend using it and we can't really support it.
Thank you for your reply.
I followed your procedure with 2 cases.

One is the default case which has the following error message.
read_grib.c:48:10: fatal error: '/usr/include/time.h' file not found
I attached the following two files with this case.
- configure.wrf_default.txt
- log.compile_default.txt

The other is the case that I deleted following line in external/io_grib1/grib1_util/read_grib.c.
#include <time.h>
I attached the following two files with this case.
- configure.wrf_deleted_time_h.txt
- log.compile_deleted_time_h.txt

I have modified WRF codes that previously used in a UNIX machine, that's why I want to install this old version.
I hope somehow I can install it.


  • log.compile_default.txt
    756.7 KB · Views: 50
  • configure.wrf_default.txt
    19 KB · Views: 49
  • log.compile_deleted_time_h.txt
    794.7 KB · Views: 53
  • configure.wrf_deleted_time_h.txt
    19 KB · Views: 43
I was able to find this by searching for your error:
See if that helps at all.
Thank you very much!
I followed that page and modified the line in read_grib.c as follows:
#include 'time.h'
However, I got following error in log.compile:
read_grib.c:50:10: error: expected "FILENAME" or <FILENAME>

Therefore, I followed that page and modified the line in read_grib.c as follows:
#include <time.h>
Then, no error message concerned with read_grib.o appeared.
However, there still error messages and no .exe files generated.

I attached configure.wrf file and log.compile file.
And I cannot understand what those error messages imply...


  • configure.wrf
    19 KB · Views: 52
  • log.compile
    799.1 KB · Views: 49
I know that you would like to have the older version compiled, but just as a test, can you try to compile the latest version of WRF on your Mac system to see if that works?

If so, then we know that the problem is due to the older version, and not your actual system.
Yes, that latest version of WRF can be compiled without any modifications and generates .exe files.
Therefore I think other compiles or software are finely installed in my iMac.
I attached configure.wrf file and log.compile file.

To compile the older version (3.2.1), do I need to change something in configure.wrf?
The first error message in log.compile is this:
make[3]: *** No rule to make target `diffwrf.F', needed by `diffwrf'.  Stop.


  • configure.wrf
    20.2 KB · Views: 48
  • log.compile
    722.6 KB · Views: 49
Unfortunately I don't know that there's going to be one easy solution. As I mentioned before, the problem is likely that you are using a much newer compiler with a much older version of WRF. The code back then (10 years ago) was written to be compatible with the current versions of compilers at that time. As GNU has also be changed several times since then, it is probably going to find a lot of problems with this code. I'm also unable to get it to compile. We don't have any versions older than 3.6 compiled.

As the error is claiming to have a problem with the diffwrf file, you can start by checking in the external/io_netcdf/ directory just to make sure that the diffwrf.F90 file is there. If that doesn't seem to be the problem, perhaps you could look at newer code and find the makefile from that same directory and use the "diffwrf" part of the newer makefile to over-write the diffwrf part of the older makefile and see if the modifications over the years make any difference. This may not be the best choice and may lead to additional problems, but I'm not sure.

You could also see if you can get standard V3.2.1 code to compile (without your modifications) to make sure it's not a problem due to your modifications.

Unfortunately, when the problems become due to compilers, we cannot help very much, as we don't support the compilers, and don't support code that old. If it's absolutely necessary to get this compiled, I would recommend just trying to do some web searching for the errors you're seeing. You may not be able to find WRF-specific errors, but may find some that are similar for other code types, with suggestions to correct the problems. I suspect with each fix, you're going to continue to run into new errors, but maybe eventually you'll be able to get it all compiled. If you do, please update this post with the things that worked, as it may help someone in the future!
Certainly diffwrf.f90 exits and the same error message had appeared when compiling the standard V3.2.1 code.

I will continue searching for solutions and trying modifications.
It seems very difficult to compile this version of WRF with current compiles, though.

Many thanks for your kind support!

And if anyone else has any suggestions to solve this problem, I'd greatly appreciate.