josher

Well-known Member
Joined
Sep 5, 2010
Posts
6,745
Likes
176
i need host file ..for iphone

How to edit the hosts file in iOS

Posted on January 16, 2013
Recently, I needed to view my website on an iPad in a test environment. My test server is on an internal network, which is impossible to view without write access to a hosts file.
I’m glad to say that I finally managed to bend the iPad to my will, and – although it feels like it may have gotten the best of me – my sanity is mostly intact. Since I am such a generous person, I will spare you from hours of frustration and tell you how to edit the hosts file in iOS. Just follow these instructions, and everything will be okay.
First of all, if you haven’t jailbroken your device, you will need to do that first.
Notice: I do not recommend jailbreaking your device!!!
With that mandatory disclaimer out of the way, if you have to do it, I suggest upgrading (or downgrading, if you made the mistake of upgrading to iOS 6) to iOS 5.1.1 and using Absinthe 2.0.4 to jailbreak. (See here for a tutorial.) The folks at Chronic Dev Team and iPhone Dev Team have done a great job at making it a mostly painless process. (If you want to jailbreak a different version of iOS, then… well, good luck to you.)
EDIT 4/15/2013: Shortly after I wrote this, a tool called Evasi0n made it possible to jailbreak any version of iOS up to and including 6.1.2, but not 6.1.3. (See here.)
Once that’s done, open Cydia (which will appear on the springboard) and download iFile. You can spend a few bucks to get the full-featured version, but you don’t need to for what we’re doing.
Next, launch iFile and navigate to the root (/) directory. Tap on the hosts file, and select the option to open it with Text Viewer. From here, you should be able to edit and save the file.
This is all pretty standard stuff to anyone with Unix experience. However, there is one thing about the hosts file in iOS that tripped me up for HOURS:
Make sure you leave a blank line at the end of the hosts file!
For whatever reason, the operating system simply refuses to read the last line of the hosts file. Anything you put there will be IGNORED.
That’s it. Have fun! And please let me know if you find a decent five row keyboard in Cydia. I literally cannot function in a terminal without ARROW KEYS.
 
Back
Top