Finder rejecting/renaming file extension

file extensionsfinder

I was just attempting to set up a local web project, and came across a peculiar behavior. If I try to change an existing filetype from anything to .scss, Finder ends up rejecting the new filetype and appending the old one to it.

Renaming styles.css > styles.scss becomes styles.scss.css

Renaming blank.txt > blank.scss becomes blank.scss.txt

If I use terminal or a text editor to rename and save the file as styles.scss, finder just leaves off the extension and shows it as styles.

This doesn't happen with a .sass extension, so I can just use that for now – but I have other projects that use .scss so I'd like to be able to get around this if possible. Has anyone run into this issue, or found a way to resolve it?

Best Answer

Found the answer in a related question here: Prevent automatically appending file extension when renaming file

The solution was to turn on the Show all filename extensions option in the Finder preferences; for some reason having it disabled forces Finder to append a "sensible" extension to files. This also solved a problem where my .gitignore and .htaccess files were being appended with an invisible .txt