Search code examples
bashmacosapplescriptautomator

change run from script path in automator


First of all, my OSX is 10.14.4 and i had bash v3 built in OSX, recently i updated to bash v5 through brew. and i did change default by chsh -s /usr/local/Cellar/bash/5.0.3/bin/bash everything else works fine except some apple workflow/script which utilize "Run from script"

when i try to switch from v3 to v5 in automator, there isn't any option. enter image description here

so my question is that does anyone know how to add new bash option to automator?

Thanks


Solution

  • You have to edit your Shells.plist file which can be found at:

    /System/Library/Automator/Run\ Shell\ Script.action/Contents/Resources/Shells.plist
    

    Add these following lines :

    <key>/usr/local/Cellar/bash/5.0.3/bin/bash</key>
    <dict>
        <key>args</key>
        <array>
            <string>-c</string>
            <string>%</string>
            <string>-</string>
        </array>
        <key>script</key>
        <array>
            <string>cat</string>
            <string>for f in "$@"&#10;do&#10;&#09;echo "$f"&#10;done</string>
        </array>
    </dict>