If DISM is hanging during the execution of the command, it is generally recommended to wait a bit longer, as the process can sometimes take a significant amount of time, especially if there are many files to check or repair. However, if it has been stuck for an extended period (like over an hour), you may consider closing the Terminal window and restarting the process.
Before you do that, ensure that your internet connection is stable, as DISM may need to download files from Microsoft Update servers to complete the operation successfully. If you continue to experience issues, you might want to check for any antivirus software that could be interfering with the process and consider disabling it temporarily.
If you decide to restart the process, you can run the command again:
DISM.exe /Online /Cleanup-image /Restorehealth
Make sure to run the command prompt as an administrator for the best results.
References: