⚠️ Caution When Running Scripts

@cfriend, I'm not picking on you here. I just want to make a point for all users.

###ATTN: All Users -- Caution When Running Scripts

I strongly advise against running a script, any script, but particularly a shell script, that:

  • You didn't write yourself
  • Did not come from a very trusted source, AND You do not understand

Shell Scripts can do just about anything, anything the user has proper permissions for.

As @cfriend just learned, the results can be catastrophic. Fortunately he has a backup. Most users I know don't have a proper/current backup.

If you have any doubts about any script, post the script here (in a new Topic), and ask for help.
I'm a novice shell scripter myself, but we do have a few very experienced folks here for almost every scripting language.


Thank you for the warning and the tip the scripts before the installation here to post :+1:

Glad I could be of service :wink: I won’t be making that mistake again.

RE: backups, with the exception of fiddling with system preferences, I am back up and running in under ten minutes thanks to good backups. I use Arq to back up to a micro SD, Amazon Drive, Dropbox, and a NAS in the closet. This is overkill, but I encourage anyone without multiple backups of your important files to look into it immediately.

1 Like

No, that is not too much @cfriend :wink: Have 3 external hard disks in use. 2 x Time Machine and 1 x ChronoSync. With ChronoSync I synchronize my iMac and my MacBook, if times one fails I always have a current Mac at hand

1 Like

There’s no such thing as too many backups.

1 Like

Once in a while I also do such things. And it always happens when testing/debugging my own scripts, not scripts from others :grinning:. Last time I managed to erase two-thirds of my /Applications folder before I noticed that something was going wrong.

Best thing to have in case of such misadventures is an exact (and recent) clone of the volume.

Move = copy + delete

My feeling is that it may be a good rule of thumb to avoid, as much as possible, the sharing of any script that involves any kind of delete component, explicit or implicit.

(Even where the value of some kind of delete really does seem absolutely likely to outweigh the risks, better, I personally feel, to disable the delete by default in the script, and explain to the user what they would have to do to set a delete enabled option, while also explaining the risks and liabilities).

Perhaps there’s an argument for naming a thread like this ‘Caution when sharing or running scripts’ ?

Just to clarify, this was a script I found out in the wild, not here.

1 Like

Hey Christian,

I'm glad to hear it.

One of the big pitfalls with shell scripts is the fact that the macOS allows spaces in file names.

If you don't know how and when to properly escape spaces or quote paths then you WILL have an accident – it's only a matter of time.

As you unfortunately discovered – that can be quite catastrophic.