You can use custom host names as long as you set them up right in the 127.0.0.0/8 loopback address range. For most people, 127.0.0.1 is enough.
It doesn’t matter what operating system you use. There are software packages available for almost every desktop computer operating system. I won’t say anything about mobile operating systems because I don’t believe a good web developer will use any of them.
I could be wrong, of course, as I am on so many occasions. Please prove me wrong.
I’m not familiar with any of the Apple operating systems. If it uses UNIX as the underlying platform, it will work just like Linux. If it doesn’t, your guess is as good as mine.
The file to edit on Linux is: /etc/hosts
On Windows, it’s: C:\Windows\System32\Drivers\etc\hosts
Just add a line like this to it:
127.0.0.1 mywebsite.local www.mywebsite.local
You can use almost anything you want as long as you don’t use an online TLD (.com, .net, .org, etc.). Some software packages will do it for you (though you may not like how they do it).
Since my local machine uses the desktop version of my server operating system (Linux Mint uses Ubuntu), I have everything installed the same way. I use Nginx, MariaDB (localhost only) and PHP. I have more programming languages available on both machines, but I rarely touch them.
I don’t do web development work daily but I use my localhost server every day. I’m using WordPress locally as my CMS and static site generator and I’m slowly putting together my own CMS to replace it. I’m now hung up on the website design, both the back end and the front end.