Editing the WordPress .htacces file on Mac OS

Earlier today, I was attempting to edit the .htaccess file of my WordPress site on my Mac. To begin with, I couldn’t see the file on my cPanel hosted File Manager (it is set up as a hidden file). In order to get to the file, I had to FTP a copy across from my server onto my client machine, which happens to be a Mac.

Now I’m familiar on how this works with a PC – I’ve been a PC user for over 20 years now. Doing this on a Mac was a little different.

The issue was that even though I know I had downloaded my .htaccess file to my folder on my Mac, it wouldn’t show up. It was hidden. Unlike windows, there’s no easy way to “Show hidden files” in Finder as there is in Windows Explorer. I had to Google how to do it. Here’s how…

To show hidden files, first open up the Terminal app. If you’ve never used this, it’s here:

Applications > Utilities > Terminal

Right after the dollar sign you can go ahead and type or paste in the code below, and press enter.

defaults write com.apple.finder AppleShowAllFiles TRUE

At this stage, nothing will happen. To put the changes into effect, you will need to restart Finder for the changes to take effect. To do this, you can either

  • press option+command+esc to open the Force Quit Applications window, select Finder from the list and hit “Relaunch”, or
  • simply type in the code below in the Terminal window, and again press enter.
killall Finder

If you typed those lines correctly, your desktop icons should disappear for just a second while Finder restarts. Your changes have now gone to effect, and you ought to be able to navigate to your folder, and see your .htaccess file.

At this stage, all hidden files on the system ought to be visible. A lot of these will be system files.

You need to be careful while remembering that deleting any system files can break stuff on your computer. You need to take care not to edit anything that you are not familiar with.

Once you’re done editing your .htaccess file, you will probably want to restore your settings so that you don’t delete something by mistake.

To hide the files again, go back in the Terminal window, and type the following code in:

defaults write com.apple.finder AppleShowAllFiles FALSE

You need to restart Finder just like you’d done previously with killall Finder or the Force Quit Applications window. That’s all there is to it!

Leave a Reply

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