How to Save PHP Files in Mac TextEdit

PHP Code on a screen shot with shallow depth of field

Scott-Cartwright/Getty Images

TextEdit is a simple text editor that comes standard on every Apple Macintosh computer. By following a few simple steps, you can use the TextEdit program to create and save PHP files. PHP is a server-side programming language that is used in conjunction with HTML to enhance the features of a website.

Open TextEdit

​If the icon for TextEdit is located on the dock, as it is when the computer ships, just click the icon to launch TextEdit. Otherwise,

  • Open a Finder window by clicking on the Finder icon in the dock.
  • Choose Applications from the menu on the left.
  • In the list of applications on the right side of the screen, find and double-click TextEdit.

Change the TextEdit Preferences

  • From the Format menu at the top of the screen, choose Make Plain Text. If you don't see this option, but see "Make Rich Text," the document is already set for plain text.
  • Select Preferences from the TextEdit menu at the top of the screen.
  • Click the New Document tab and confirm the radio button next to "Plain text" is selected.
  • Click the Open and Save tab and confirm the box next to "Display HTML files as HTML code instead of formatted text" is checked.

Enter the Code

Type the PHP code into TextEdit.

Save the File

  • Choose Save from the File menu.
  • Enter your_file_name.php into the Save As field, being sure to include the .php extension.
  • Click the Save button.

If a pop-up asks you if you want to use .txt or .php as the file extension. Click the Use .php button.


You cannot test your PHP code in TextEdit. You can test it in PHP if you have it on your Mac, or you can download an emulator app from the Mac App Store—PHP Code Tester, PHP Runner and qPHP can all be used to test the accuracy of your code. Just copy it from the TextEdit File and paste it into the application screen.

mla apa chicago
Your Citation
Bradley, Angela. "How to Save PHP Files in Mac TextEdit." ThoughtCo, Aug. 27, 2020, Bradley, Angela. (2020, August 27). How to Save PHP Files in Mac TextEdit. Retrieved from Bradley, Angela. "How to Save PHP Files in Mac TextEdit." ThoughtCo. (accessed May 29, 2023).