I'm trying to open the /private/etc/apache2/httpd.conf
file to make some changes. I thought I'd be able to open this with the correct permissions from the command line, so I tried:
cd /private/etc/apache2
sudo open -a TextEdit httpd.conf
This opened the file in TextEdit, but TextEdit gave me this message:
You don't own the file "httpd.conf" and don't have permission to write to it. You can duplicate this document and edit the duplicate. Only the duplicate will include your changes.
Fine. Apparently using open
even with sudo
opens the app as the user. So I tried this:
sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit httpd.conf
But I immediately get this popup:
The document "httpd.conf" could not be opened. You don't have permission. To view or change permissions, select the item in the Finder and choose File > Get Info.
This makes TextEdit hang too, so I have to force quit it.
I also tried to open the file using my Komodo text edit, which is my normal development environment:
sudo -b /Applications/Komodo\ Edit\ 8.app/Contents/MacOS/komodo httpd.conf
The terminal spits out this strange message:
2014-09-24 11:48:29.583 komodo[30647:507] * WARNING: Method userSpaceScaleFactor in class NSWindow is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
And Komodo opens, but doesn't open the file. How do I edit this file with my program of choice?