Edit the Host File on Mac OSX 10.6 and point it to Windows 7 localhost in Parallels 6
Pointing out your local sites in the host file in Windows is easy but I found out it wasn’t that obvious on Mac. Especially when you need to point to localhost on your Windows machine running in Parallells. This is how I did it.
How about that awesome word spamming title? Sweet!
Being a Mac user, otherwise obvious things becomes hard when developing in a .Net environment. Since I have to use Visual Studio, I need to work in Windows parallel to OSX. So I deiced to go for Parallels 6 and install Windows 7. Basically I use Windows for two things only; work with Visual Studio .Net projects and test the websites in Internet Explorer.
Pointing out your local sites in the host file in Windows is easy but I found out it wasn’t that obvious on Mac. Especially when you need to point to localhost on the Windows machine running in Parallells. This is how I did it.
Get the Windows Virtual Machine IP address
This might be usefull for Mac users not familiar with Windows. Windows users can probably skip this part.
- In the dock, click the Parallels Deskotop icon and type cmd in the search field. Then hit Enter to open the Command Prompt.
- In the Command Prompt, type ipconfig and hit enter. Now look for the Ethernet adapter Local Area Connection IPv4 Address. This is the IP that should go in your host file on the Mac.
Find the host file on the Mac and modify permissions
- Open up the finder and hit Cmd+shift+G to open up the “Go to the folder” popup. In the textfield type /private/etc.
- Hit Go and you will get this
- Now we need to edit the permissions on the Private and etc folders and on the host file located in the etc folder. Right click each one of them and choose Get info.
- Click the lock icon in the bottom right corner in the info window. With the lock icon open click the plus sign in the bottom left corner to add your user. Now set the user Previlege to Read & Write. If you want you can click the lock icon again to close it.
- (Optional) For easy access you can drag the host file to the left hand menu
Point the host file to the Virtual Machine localhost
Isn’t that sweet, now you don’t need to use that “ugly ass hell” IP address in the address bar in the browser anymore. Now you can use the same hostnames as you do on your Windows machine.