4

I always have hidden files set to 'visible' in Finder, because I'm a developer and I work with a lot of dotfiles.

But even with this setting, Finder won't let me rename a file beginning with a dot. It also won't let me modify these files by pasting over them etc; it gives an error like "The item “.gitignore” can’t be replaced because it’s invisible." Well, it's not invisible, I can see it, and I want to replace it, and it's mine.

I know how to use mv. I am asking about doing this with Finder.

1
  • 1
    What step specifically do you perform to make invisible files exposed by Finder? What version of Finder / OS X are you running? The error I receive is "You can’t use a name that begins with a dot “.”, because these names are reserved for the system. Please choose another name."
    – bmike
    Aug 21 '15 at 15:56
4

On macOS 10.15 Catalina through 12 Monterey, you now get a warning when you create or rename an "invisible" folder or file, but you are not longer blocked from renaming them.

enter image description here

On El Capitan (beta build 15A263e), I can not rename dot files and get this message:

You can’t use a name that begins with a dot “.”, because these names are reserved for the system. Please choose another name.

I use the third party tool Transmit to make changes to invisible files and folders. I wish I knew a way to modify Finder to do what you ask, but someone trickier than I will need to step up with instructions if they are known.

Some time between 10.8 and 10.11 this was prohibited and some time between then and 12 it's allowed again.

1

I do not know what version of OS X you're using however I have no problem renaming dotfiles in Finder under OS X 10.8.5. That said, If your using a version of OS X that will not allow you to rename dotfiles in Finder and you do not want to use Terminal and the mv command, then a GUI option you can consider using is muCommander.

1

You can solve this by doing one of the following to show hidden files (from https://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/):

  • Press Cmd-Shift-. in Finder to toggle showing hidden files
  • Run defaults write com.apple.finder AppleShowAllFiles YES and restart Finder

Once you have done this, the system will only warn you when creating dot files.

0
-3

You could make an Automator service with a hotkey that pops up and asks for a new name

EDIT:

I did the work for you.

Add it to ~/Library/Services and define a hotkey in System Preferences.

1
  • Could you expand on this? Perhaps show an example of how you would build such an Automator service?
    – Ian C.
    Aug 21 '15 at 21:39
-3

The answer may be different per scenario but the first thing you must do is make hidden files visible with CmdShift+.

Then you try to rename as a "dot" file.

(ADDITIONAL)based on comments: here are more details.

I did not add MacOS version to my answer because the question was from 2015 and I tested across Catalina, Big Sur, and now Monterey as I migrated from an old MBP to a 2021 MPBM.

I also learned that a very reliable solution is to use terminal to change the file name.

mv (option) file1.ext .file1

file1.ext is the original file's name, and .file1 being the new name.

7
  • 2
    It seems the OP already has done this ("I always have hidden files set to 'visible' in Finder") and Finder seems to prevent the renaming part.
    – nohillside
    Nov 7 '21 at 15:00
  • Please edit this to show how you rename a file from say .yes to .nope and which version of macOS / Finder this worked for you. In my testing finder was not amenable to this task.
    – bmike
    Nov 7 '21 at 15:26
  • 1
    Right on! I've edited my answer to collect which OS allowed it, which prohibited it and now we can use "hidden files again" - this seemed like a harsh and arbitrary restriction IMO @nohillside
    – bmike
    Nov 7 '21 at 15:45
  • 1
    @bmike It seems to work since at least 2.5 years apple.stackexchange.com/a/363374/9058
    – nohillside
    Nov 7 '21 at 16:01
  • 1
    I've tested back to Catalina @nohillside - may not have Mojave at home anymore that boots..
    – bmike
    Nov 7 '21 at 22:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .