If you want to check MPS availability using a one-liner in the command line, you can use the following:
python3 -c "import torch; print(f\"MPS is {'' if torch.backends.mps.is_available() else 'not '}available\") "
This one-liner imports the torch
module, checks if MPS is available, and prints the corresponding message.
python3 -c "import torch; print(torch.backends.mps.is_available())"