Change macOS computer name

I recently upgraded to a new M1 Pro Macbook Pro and the computer is managed by the company.

It means that — for one reason or the other, spuriously documented on Apple discussion forum — I was not able to change the computer name.

can't change computer name on macOS

A good soul documented the solution, that I am reporting here for my future self: fire up the terminal and type

sudo scutil --set ComputerName <your_name_here>

Voilà!