I am new to Mac but used Ubuntu for development for a long time. I know how to create virtual hosts in Ubuntu but have no idea about Mac. I have created a hosts
I followed this post, as recommended by szatti1489, and it worked for me: https://www.taniarascia.com/setting-up-virtual-hosts/
A couple of points are worth mentioning though:
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf.test domain ending, not .dev for my VirtualHost ServerName. The post mentions this, but then continues using.dev. Apparently, Chrome didn't support the .dev domain ending after 2017, although it didn't work in Firefox or Safari for me either.