Can I double click to run SH Files on Mac?

Hi,

At windows, we can use double click to run assigned file, does the method can be used in mac,such as sh file, or workflow file?

Thanks.


[Re-Titled by Moderator]

Posted on Oct 23, 2024 7:28 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 24, 2024 1:01 PM

Normally you double-click a macOS executable within the Finder (whether it is a compiled app, or script). However, with some macOS security settings the executable may not run unless macOS is told it is safe to run that macOS executable file.


Even if a shell script is made executable, I have encountered times I cannot double-click the shell script to run it because double-clicking opens it in the text editor. For some reason macOS assigns extended attributes to the shell script file to cause it to open in a text editor. Once I remove those extended attributes (using the command line 'xattr') I am able to double-click the executable shell script & have it run. If you use a GUI app to edit the shell script, you will need to remove those extended attributes again before you can double-click the script to run it.

2 replies
Question marked as Top-ranking reply

Oct 24, 2024 1:01 PM in response to show0116

Normally you double-click a macOS executable within the Finder (whether it is a compiled app, or script). However, with some macOS security settings the executable may not run unless macOS is told it is safe to run that macOS executable file.


Even if a shell script is made executable, I have encountered times I cannot double-click the shell script to run it because double-clicking opens it in the text editor. For some reason macOS assigns extended attributes to the shell script file to cause it to open in a text editor. Once I remove those extended attributes (using the command line 'xattr') I am able to double-click the executable shell script & have it run. If you use a GUI app to edit the shell script, you will need to remove those extended attributes again before you can double-click the script to run it.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Can I double click to run SH Files on Mac?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.