13
6
I'm trying to add a line into the hosts file on my Mac by executing a one line command on the terminal.
I thought this would be easy using sudo, but it returns "permission denied" when I try to add >>
to the hosts file, but it works if I try replace >
the hosts contents.
sudo echo test >> /etc/hosts
-bash: /etc/hosts: Permission denied
$
sudo echo test > /etc/hosts
Password:
$
OS is up to date.
simply use a text editor (started with sudo) to modify your /etc/hosts – MrSmith42 – 2013-01-19T21:08:15.943
1I want to make a script that will help automate this, so a text editor wouldn't help in this case. – Mint – 2013-01-19T21:12:58.763