0

I have a created an executable Perl script, starting with

 #!/usr/bin/perl

and have called it t. So when I launch ./t on the Terminal the script is executed and everything is fine.

But apparently some hidden daemon in my computer does not like this, and after a few minutes of existence under the name t, the file's name is automatically changed into t.pl.

I find this unacceptable. Don't I have the right to name files as I want on my machine? It is not a system file, just a personal script in my home directory. How can I avoid this intrusion of Apple into the private life of my files?

  • 2
    What editor are you using to create the file? – Nimesh Neema Nov 17 '18 at 8:46
  • 4
    That‘s not standard behavior in macOS. What other applications, utilities etc do you have running? With which editor do you create the file? If you run cp t t1, does the copy get changed as well? – nohillside Nov 17 '18 at 8:48
  • I use BBEdit to create the file. I just did the test: after a mv t.pl t it takes about three seconds to be transformed back again into t.pl. During those three seconds I did a cp t t1 and the t1 remains without extension, even if I execute it. Following your advice I removed t.pl and copied cp t1 t, and the new file name seems to remain stable. What happened? Who was the evil spirit changing my file's name? BBEdit? – yannis Nov 17 '18 at 9:16
  • 1
    I have lost touch about the newer versions of macOS, but the file system used to store files using a file name and an additional MD5 hash, which allowed it to find files back should they have been moved or renamed and even allowed open applications to be moved. So, if you, at one point, saved the file accidentally as t.pl and opened it (with an editor/itself) and then simply renamed it t while still opened, whatever had a tap on that file may have renamed it back. Copying the file as t1 and then back to t will change the MD5 hash, so any other program likely lost track on the file. – Phoenix Nov 17 '18 at 10:09
  • 1
    @Phoenix macOS has never used such a system with MD5 hashes as far as I know. It is pretty standard on Unixoid systems (including macOS) that you can move, rename, etc. open files (including applications). The programs that have these file open do not access them by filename or path, but rather by inode. – jksoegaard Nov 17 '18 at 12:43

You must log in to answer this question.

Browse other questions tagged .