I installed MacTex 2021, and in /usr/local/texlive, there is only 2021 file. But when I tried to install a package in terminal, it still says " Local TeX Live (2020) is older than remote repository (2021). Cross release updates are only supported with update-tlmgr-latest(.sh/.exe) --update See https://tug.org/texlive/upgrade.html for details." I am wondering how I can fix this problem. Thank you!
It looks like you have TinyTeX installed.
So there are two options. Either you want to switch to MacTeX (which is a full TeXlive distribution) or you want to upgrade your TinyTeX. The latter is documented on the TinyTeX homepage:
If you see an error message “Remote repository newer than local”, it means it is time for you to upgrade (reinstall) TinyTeX manually:
If you did install a full MacTeX distribution, you should uninstall TinyTeX (which should be just
rm -r ~/Library/TinyTeX although I don't see it in your path in your comment).