Everyday I receive many emails in my inbox asking for ways to access blocked websites like Facebook and Twitter. It seems like more and more governments are blocking social networks to control the flow of information tightly. According to what I know, China, Vietnam, Iran, Uzbekistan, Pakistan, Syria and Bangladesh have already banned Facebook completely. Those are the reasons why people in these countries have to find indirect ways to access to Facebook.
I mentioned 7 ways to access blocked Facebook in a post last year and still update it regularly with working solutions. However, I forgot that those are tips for Windows only, so many readers have emailed me and told that they don’t know how to apply those tips for MacBook. I am sorry I can’t reply all your comments and emails, hopefully you will find this post useful. Check out the simple steps below to access restricted Facebook on Mac OS X.
Step 1: Open Terminal
We can open Terminal either by typing Terminal on the Spotlight, or by navigating to Applications – Utilities – Terminal.

Step 2: Edit Hosts File
The Hosts file is the text file mapping particular hostnames to certain IP addresses. When you type in a URL address on Safari, the system will check in the host files to see if there is a relevant entry. If there is, it will get the corresponding IP address, else it will move on to the DNS server to find the IP address.
Now we need to open the Hosts file to edit it. Type in the following command in the Terminal:
sudo nano /private/etc/hosts
Enter your administrator password when prompted.
The hosts file will be opened for editing.

Next, add following lines to the bottom of this file:
153.16.15.71 apps.facebook.com
125.252.224.88 facebook.com
125.252.224.88 www.facebook.com
153.16.15.71 login.facebook.com
153.16.15.71 graph.facebook.com
153.16.15.71 static.ak.connect.facebook.com
153.16.15.71 developers.facebook.com
153.16.15.71 error.facebook.com
153.16.15.71 upload.facebook.com
153.16.15.71 register.facebook.com
153.16.15.71 bigzipfiles.facebook.com
153.16.15.71 pixel.facebook.com
153.16.15.71 0.132.channel.facebook.com
153.16.15.71 1.132.channel.facebook.com
153.16.15.71 error.132.channel.facebook.com
Press control-O to save the file.
Step 3: Flush DNS Cache
To make the changes take effect, we then need to flush the DNS resolver cache. Enter the following command in the Terminal:
dscacheutil -flushcache
You now can exit Terminal and access Facebook like normal. Leave a comment below if you have any problem.
i tried following these steps and it seemed to work perfectly at first, but now the wifi is not working properly and in systems preferences -> network it says i’m connected using airport, but that ‘airport has a self assigned IP address and may not be able to connect to the internet’
any suggestions?
Thank u for sharing
but it did not work for cafeworld hichic
worked like a charm, THANK YOU SOOOOOO MUCH!!!!!!! have been off fbook for almost 2 months and it was driving me crazy – you are a total legend!!!
Hi Tuan,
I don’t know why Facebook got blocked from my Mac even I’m in the States right now. I tried to follow your steps but I stuck with the step 3. I am not sure where to put the command, you mean right after the last line or what, because when I did so it does not really work and the Facebook page is shown as invalid URL.
Hi Tuan, again
Nevermind of my question, it’s working now lol. Thanks a lot for this article !!!
Hi Tuan,
:(
There is only text without any pictures
The speed of loading fb is slow also
Hi Trang,
I don’t know what’s the problem with your network. I can access Facebook very fast here with almost all ISPs in Vietnam.
it didn’t work for me. I think you need to be clearer about what to do after you press control-O to save the file and where to paste ‘dscacheutil -flushcache’. I know you’ll probably say ‘in the terminal’ but i don’t know how to get out of the ‘File Name to Write: /private/etc/hosts’ section.
I was having the same problem. This is what you have to do:
After control-O press “Enter” and the screen will change slightly signifying it has saved. Then follow the command at the bottom for Exit which is ^X (press ctrl+^+X) and it should exit back to the terminal. Then type in dscacheutil -flushcache and press “Enter” again and then you can close it and everything will work. I hope that helps.
You’re a star, it worked.
God bless you!! My vpn stopped working, and now I can access it by following your steps. Everybody that has a mac should give this a try! Thank you Tuan Do!
I did all the steps on my macbook and it worked. However, I did the same to my grandma’s macbook but I messed it up. I tried resetting it, so I deleted the codes, including the below code and I saved it.
##
# Host Database
#
# localhost is used to configue the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
Facebook still comes up, but only the homepage. If I click on anybody’s profile, or I click on a picture, it is blocked. I don’t know what to do and I am scared my grandma will be angry at me!! What did I do wrong?? I also did not create any back up.
Please try to reply soon. Thank you
I realised that I have to keep putting “s” into the http so that the website comes up. When I click on a profile on facebook, it makes facebook become unsecure. what can I do to solve this so that facebook remains on “secure” at all times?
Now I cannot upload photos anymore. why is that? Please help!!
How do you change it back? I am back to the US and would like to change my settings back to what they were before. Thanks!
For those of you that cannot type in your password in terminal, there is a simple reason for this – ANY password terminal asks you to enter will not display, this is for your own security (so anyone near you that may be watching won’t be able to see what your password is). Just go ahead and type your password in like you normally would and hit enter when you are finished. You won’t see it, but that’s okay
Tuan, you should make this info available in your instructions as a lot of people don’t seem to realize that this is just a part of how Terminal works. Cool article by the way, I’m sure it will help a ton of people!
Tuan,
This worked great when I was in Vietnam, however, I am no longer there and my facebook is doing funny things ex. cannot upload pics, how do I revert back to my original settings?!?! Thanks a lot
remember when you leave vietnam china etc to PUT IT BACK THE WAY IT WAS! i didn’t and my facebook was broken for two months. couldn’t upload photos and notifications wouldn’t refresh they would just bank up. this definitely works but don’t leave your terminal like this.
Clem,
I am wondering HOW I can put it back the way it was, thnx if you can help.
Hi Tuấn,
Could you pls help to instruct the last step : Flush DNS cache, I copied the words and copy down below the lines….but when I want to exit, it prompt me asking that ‘are u sure to exit, otherwise all information will be erased ??