Installation/Delete intermediate files
This page explains the steps to follow for each series of OpenFOAM versions/forks/variants on which temporary folders can be deleted after building OpenFOAM from source code, which can save disk space between 2 and 10 GB. This includes:
- the intermediate object files that were used to build OpenFOAM, namely the files with the extensions *.o;
- the dependency files that were used to know which files each source file depends on, namely the files with the extensions *.dep;
- the intermediate files used to build the software at the ThirdParty folder.
However, please keep in mind the following limitations:
- Removing the *.o files will result in having to rebuild the whole library or application in OpenFOAM, if you need to do some modification to the source code of said library. In other words, it's as if you had executed the command wclean for each library or application folder.
- Removing the *.dep files will in practice have the same effect as removing the *.o files, given that these files are both needed in case you are only updating the build of a library/application.
- Removing the intermediate files at ThirdParty folder can either:
- affect the ability to build the OpenFOAM reader libraries for ParaView, although this only happened for old versions of ParaView (~3.12.0 or older, if not mistaken);
- having these intermediate files can allow you to do minor rebuilds, for example, to build ParaView with other build options;
- removing the source code folders for large software packages, such as Boost and GCC, can save up a lot of disk space.
2 OpenFOAM 1.7.x to 2.4.x
- To remove all object files (*.o), run the following commands:
foam rmoall src applications
- To remove all dependency files (*.dep), run the following commands:
- To remove the complete intermediate build folder for all source code folders (it removes the intermediate _make_ files that wmake creates before it starts building a library or application), run the following commands:
foam find src applications -name "linux*" | grep "/Make/" | xargs rm -r
- To remove all intermediate build files, run the following commands:
foam3rdParty rm -r build
- To remove all third-party source code folders that installation instructions may tell you to download and build, which in total can add up from 500MB to 2 GB, run the following commands:
foam3rdParty rm -r gcc-* gmp-* mpfr-* binutils-* boost* ParaView-* qt-*
3 OpenFOAM 3.0.0 and newer
4 OpenFOAM+ v3.0+, v1606+, v1612+, v1706 and newer
5 OpenFOAM-extend 1.6-ext, as well as foam-extend 3.0 and newer