How to edit a file in a protected folder

  1. Open a terminal window (Applications/Utilities/Terminal)
  2. Change the current folder to the target folder (myfolder)
  3. If you want to create the target file (myfile)
    1. Type: sudo touch myfile
    2. Authenticate with the admin password
  4. If the folder is hidden in Finder, show hidden files in Finder
  5. Find and enter myfolder in Finder
  6. Drag and drop myfile from myfolder to the Desktop
  7. Edit myfile from the Desktop with any editor
  8. Save the file to the Desktop
  9. Drag and drop myfile from the Desktop to myfolder
  10. When asked, choose Replace
  11. Authenticate with the admin password

Leave a Reply

Your email address will not be published. Required fields are marked *