Contents
1 Introduction
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.
NOTE: This is meant only to remove intermediate files. If you want to uninstall a specific OpenFOAM version/fork/variant, see the FAQ entry How to uninstall/remove OpenFOAM?
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:
foam rmdepall
- 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
Note: This refers to the versions provided by the OpenFOAM Foundation.
- To remove all object files (*.o), run the following commands:
foam find platforms/*/applications platforms/*/src -name "*.o" | xargs rm
- To remove all dependency files (*.dep), run the following commands:
foam find platforms/*/applications platforms/*/src -name "*.dep" | xargs rm
- 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 rm -r platforms/*/applications platforms/*/src
- To remove all intermediate build files, run the following commands:
cd $WM_THIRD_PARTY_DIR 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:
cd $WM_THIRD_PARTY_DIR rm -r gcc-* gmp-* mpfr-* binutils-* boost* ParaView-* qt-*
4 OpenFOAM v3.0+, v1606+ and v1612+
Note: This refers to the versions provided by ESI-OpenCFD.
Nonetheless, these versions still followed the same convention as in OpenFOAM 3.0.0 and newer.
5 OpenFOAM v1706 and newer
Note: This refers to the versions provided by ESI-OpenCFD.
- To remove all object files (*.o), run the following commands:
foam find build/*/applications build/*/src -name "*.o" | xargs rm
- To remove all dependency files (*.dep), run the following commands:
foam find build/*/applications build/*/src -name "*.dep" | xargs rm
- 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 rm -r build/*
- To remove all intermediate build files, run the following commands:
cd $WM_THIRD_PARTY_DIR 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:
cd $WM_THIRD_PARTY_DIR rm -r gcc-* gmp-* mpfr-* binutils-* boost* ParaView-* qt-*
6 OpenFOAM-extend 1.6-ext, as well as foam-extend 3.0 and newer
- To remove all object files (*.o), run the following commands:
foam rmoall src applications
- To remove all dependency files (*.dep), run the following commands:
foam rmdepall
- 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 rpmBuild/BUILD/* rm -r rpmBuild/BUILDROOT/* rm -r rpmBuild/tmp/*
- To also remove the extra downloaded source code, the resulting RPM and tarball packages that resulted from the build process (although these packages are compressed and can be used to re-install without rebuilding), run the following commands:
foam3rdParty rm -r rpmBuild/rpmDB/* rm -r rpmBuild/SOURCES/*.tar.* rm -r rpmBuild/SOURCES/*.zip rm -r rpmBuild/RPMS/* rm -r rpmBuild/TGZS/*
Note: This does not delete the installed software that was custom built.