Shortcut's Run Shell Script won't let me change Shell

I updated to MacOS Sonoma 14.6.1, and a Shortcut I use through Quick Actions errors out. I get this message:

/opt/local/bin/bash: /Users/neal/Library/Group Containers/group.com.apple.shortcuts/Temporary/ com.apple.WorkflowKit.BackgroundShortcutRunner/AB89F1C0-F082-4391-9F4C-ADA8BAC87ECD: Operation not permitted

I double-checked that the Finder.app, shortcuts.app, bash, and other cli apps have Full Disk Access.


I also checked that the bash I want to use is listed in /etc/shells. I checked the $BASH_VERSION and I'm using Bash 5.2.32(1)-release. I also ran chsh -s /opt/local/bin/bash.


When I select the Shell Bash path "/opt/local/bin/bash" in the Run Shell Script, it doesn't stick. The Shell parameter always stays on "/bin/bash", which is Bash 3.2.57(1)-release (very old).


How do I fix this? I used to work fine with no errors before I updated the MacOS.


UPDATE: All of my Shortcuts that use Run Shell Script fail. All of them are stuck on /bin/bash and not the desired /opt/local/bin/bash. Also note: If I change the Run Shell Script's Shell to /bin/zsh everything works fine. I want Bash, not Zsh.



Mac Studio

Posted on Aug 26, 2024 8:55 AM

Reply
7 replies

Aug 26, 2024 2:08 PM in response to krousen

Here is how you get your Bash 5.2.32 to appear in the Shortcuts Run Shell Script Shell menu. You append that Bash path to the /etc/shells file. It is a read-only file and I was able to add my Bash 5.2.32 path to the end of that file using Sublime Text 4:


sudo subl /etc/shells

and then, I was able to use the 5.2.32 shell in the Shortcuts Run Shell Script:



However, I was never able to get past Run Shell Script errors when using this as a Quick Action and right-clicking on an image. If I set a variable to a hard-coded image file path without a for-loop and then just click the ▷ Run symbol, I get the following:


I tried everything for three hours and could not get the Quick Action with a for-loop working. Always has the same error notification. It would probably work fine if you were using the Zsh shell ;-).



Aug 27, 2024 6:59 AM in response to VikingOSX

Thank you. I've had the /opt/local/bin/bash path in /etc/shells for years. I downloaded and installed it through Macports if that means anything.


I still can't select that bash version, however, I can select other shells. I switch to zsh and it works. So I've gone and changed my shortcuts to use zsh. :(


Unless someone has a better explanation, my guess is Apple tightened security again with MacOS 14.6.1


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.

Shortcut's Run Shell Script won't let me change Shell

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