oldj / SwitchHosts

Switch hosts quickly!
https://switchhosts.vercel.app
Apache License 2.0
23.12k stars 2.45k forks source link

hosts file read-only #865

Open sdomadoo opened 5 months ago

sdomadoo commented 5 months ago

System (Mac, Windows 7/8/10, Linux) / 操作系统

MacOS Sonoma : 14.3

SwitchHosts! Version / SwitchHosts! 版本

SwitchHosts : Version : 4.1.2

Description / 描述

After installing SwitchHosts on several workstations I have the same problem: I can only read the file but not modify it. I can modify it from the terminal. I have checked the permissions and everything is fine... Does anyone have an explanation ? Thank's

ipshenicyn commented 4 weeks ago

@sdomadoo I was confused too for the first few minutes, but then I realized. The point is you don't need to modify the system file. Instead (and it's the better way), you can create a new file or even multiple new files, name them something like "project 1 hosts" or "custom hosts", turn them on, and write the rows you want. After that, SwitchHosts just merges this content to the end of the system file and they works. When you don't need those rows anymore, you just need to turn that file off and the rows disappear from the system file. It's pretty convenient, actually.