Whenever you start a virtual server you are provided with a local IP that you can access through the browser. This works fine most of the times, but if you need to use an external service like the Facebook API you might have to fake the IP as a real domain. You can do this easily by creating an alias.
Here’s how you can do it on Mac OS:
1. Open up the Terminal;
2. Type sudo vim /etc/hosts (you can use nano if you prefer);
Now the hosts file will open up on the terminal. If you decided to use vim and you aren’t familiar with it’s commands here is what you will have to do:
1. Place the cursor on the last character of the last line of the file (you can use the arrow keys for this);
2. Type the ‘a’ key to enter the insertion mode;
3. Click on the return key to create a new line;
4. Type the IP followed by the alias (127.0.0.1 yourlocalhostalias.com, for example);
5. Click on esc to exit the insertion mode;
6. Type :wq to save the file and quit the editor;
And that’s it! You should now have no problem making the Facebook API or other services work on your local machine.