If your Mac freezes or starts to run very slowly and poorly, then rebooting can help clear up memory and keep it running smoothly. There are several ways to restart your Mac that can come in handy if you are unable to access certain programs due to computer problems.
Steps
Method 1 of 6: Using the Apple Menu

Step 1. Click on the Apple logo in the toolbar

Step 2. Click on “Restart.”

Step 3. Click on “Restart” again to confirm restarting your computer
Your Mac will restart immediately.
Method 2 of 6: Using the Shutdown window

Step 1. Press the “Control” and “Eject” buttons at the same time

Step 2. Select “Restart” when the selection appears
Your computer will restart immediately.
Method 3 of 6: Using keyboard shortcuts

Step 1. Press the “Control,” “Command,” and “Eject” buttons at the same time
Your computer will restart immediately, without command confirmation.
Method 4 of 6: Using the Terminal Application

Step 1. Open the Applications folder in the Dock on your Mac

Step 2. Open “Utilities.”

Step 3. Click on “Terminal.” A terminal window will open.

Step 4. Write the following command: “shutdown -r now”
Also, you can write commands such as “reboot” or “reboot -q”

Step 5. Press “Enter” on your keyboard
Your Mac will begin the shutdown process.
Method 5 of 6: Using a hard reboot

Step 1. Stop any processes that are using the hard drive
For example, if you are copying files from a flash drive to your hard drive, wait until the operation is completed.

Step 2. Press and hold the Shutdown button on your Mac until the computer turns off
This process should take two to three seconds.

Step 3. Press the Shutdown button again to restart your computer
Method 6 of 6: Reboot Using Remote Access

Step 1. Open the System Preferences app in your Mac's Dock

Step 2. Click on the “Sharing” icon

Step 3. Check the box next to “Remote Login.”

Step 4. Close the System Preferences window

Step 5. Open an Internet browser and open

Step 6. Write “what is my ip” in the search bar and press “Enter.” Google will display your IP address at the top of the search results.

Step 7. Write down your IP address

Step 8. Log in to another computer on the same network

Step 9. Open a terminal application, or command prompt if you are using Windows

Step 10. Write the following command using your IP address in the terminal window to log into your computer remotely: “ssh username @ ip_address.”

Step 11. Write the word “reboot” in the terminal window and press “Enter.” Your computer will restart.
Advice
If your computer is completely frozen and won't open your Mac's menu items, use the hotkey method to restart your computer. The hotkey method requires no access or confirmation to restart your computer
Warnings
- Do not use the hard reboot method if you are currently working with a hard drive. As a result, you can damage your computer's hard drive.
- Don't use the terminal method to restart your computer regularly. This method prevents running processes from stopping properly and saving their settings, which could contribute to future operating system problems.