Home Download Buy Blog Forum Support

Unable to save /etc/hosts

Unable to save /etc/hosts

Postby oaziz on Fri Dec 09, 2011 3:11 pm

I ran sudo subl /etc/hosts command from my Mac and after hitting save I got "Unable to save /etc/hosts" error message.

MacVim happily saved it for me.

What's wrong?

Thanks.
oaziz
 
Posts: 15
Joined: Fri Dec 09, 2011 2:38 pm

Re: Unable to save /etc/hosts

Postby aparajita on Sat Dec 10, 2011 12:00 am

That's because the subl command ends up launching Sublime Text 2 under your user id instead of as root. The only way to do what you want is to do:

Code: Select all
sudo /Applications/Sublime\ Text\ 2.app/Contents/MacOS/Sublime\ Text\ 2


Note that this will tie up that terminal session until ST2 quits, and that it will be reading prefs from /var/root/Library/Application Support/Sublime Text 2, not your home directory.
aparajita
 
Posts: 177
Joined: Sun Jul 24, 2011 10:42 pm

Re: Unable to save /etc/hosts

Postby oaziz on Sat Dec 10, 2011 1:18 am

I do exactly the same with TextMate and MacVim and they work properly without the need of what you mentioned. I only add sudo when the file is not in my home directory. I don't even have to add sudo with TextMate, it asks me for the password when I hit save.
oaziz
 
Posts: 15
Joined: Fri Dec 09, 2011 2:38 pm

Re: Unable to save /etc/hosts

Postby aparajita on Tue Dec 13, 2011 4:53 am

I'm just telling you how it is, don't blame me. The fact it isn't necessary in TextMate and MacVim means they do a better job of dealing with it than ST2. Submit a feature request for ST2.
aparajita
 
Posts: 177
Joined: Sun Jul 24, 2011 10:42 pm

Re: Unable to save /etc/hosts

Postby aparajita on Thu Dec 15, 2011 10:37 pm

Implemented in build 2147, a lot of people were asking for this.

viewtopic.php?f=2&t=4143
aparajita
 
Posts: 177
Joined: Sun Jul 24, 2011 10:42 pm

Re: Unable to save /etc/hosts

Postby oaziz on Fri Dec 16, 2011 10:14 pm

Great, thank you for the update.
oaziz
 
Posts: 15
Joined: Fri Dec 09, 2011 2:38 pm


Return to Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 21 guests