Giving TextEdit Root For Locked Files 3


Giving TextEdit Root For Locked Files


Once as you get to know your Mac and you are more confident in how it works, and what everything does, you may want to starting playing with the system files. Usually I strongly suggest you don’t play with any of them to be on the safe side. But every so often you may need to edit a certain file to achieve a specific task. For example if you are using the web server built into a Mac and you want to edit the httpd.conf file. Normally you would have to give yourself permission to edit the file, and then open up it up. Or you could use vim or pico, a Terminal file editing program. Both of these take a while to learn (especially vim and pico) or take a long time to implement (changing file permissions). What we want is the ability to give TextEdit root powers to edit these files, while still using the GUI of TextEdit. Its rather simple.

For this little experiment I am going to use httpd.conf in /etc/apache2. This can be accessed from Finder by going to Go > Go To Folder and then typing /etc. You can then navigate to the file in question. This file, to me, is doing nothing since I am not using the web server. If you open this file, edit it and try to save you will get an error which looks something like this.

The next step is to quit TextEdit (very important) and then open up Terminal (Utilities > Terminal). Then type of following:

sudo /Applications/

It will ask you for you admin password. Once as you have entered you are ready to go. When you open TextEdit again it will have root powers to enable you to write to these locked files. If you have the Graphite (or any other theme) appearance set in System Preference, it may revert back to the blue version. It did on my machine. But it clears it self up once as the program has closed.

You can now go around editing and saving these locked files without the need to change permissions or use a Terminal program. Once as you have quit the program the sudo will be undone and you will be back to normal TextEdit.

Using this method means that you don’t have to go around changing all of the files permissions or learn vim or pico. Its simple and easy to use. You can of course open up all of the files you want with TextEdit and edit them at will. You can then be back to safe old TextEdit when the program is closed. Using this little tip means that file permissions stay the same so you don’t compromise your computers security if you forget to change them back.

Be careful since you do have sudo powers in effect, changing anything you don’t no could have disastrous consequences. A later post will be about creating a file which can run in Terminal so you don’t have to type this command over and over.

If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips