This is, without a doubt, one of the most common Mac problems. In the worst-case scenario, you just have to wait for Mac to finish working and let you get back to using it. If this doesn’t work, kill the process by force by pressing Cmd + Option + Esc or holding Option down.
To finish the loading process and free up your computer, try pressing Cmd + Q. Every time your Mac freezes up, your cursor becomes this friendly-looking beach ball, that doesn’t stop spinning and stops you from clicking on anything. There’s no Mac user who hasn’t faced the feared mice beach ball.