Cannot run unzip nor tar from Keyboard Maestro

Howdy folks, hoping some of the more shell script savvy people can chime in here.

I am looking to do something I thought was extremely simple... unzip a ZIP file using either unzip or tar in a Shell Script action. However, neither one appears to work.

For unzip I get the following error:

Archive:  /Users/cdthomer/TEMP/
error:  cannot create manifest.json
        Read-only file system
error:  cannot create user_data.db
        Read-only file system

And for tar I get the following error:

x manifest.json: Can't create 'manifest.json'
x user_data.db: Can't create 'user_data.db'
tar: Error exit delayed from previous errors.

Both commands work from the Terminal, so it’s something I’m doing wrong in Keyboard Maestro (action screenshots below -- ignore the bash comment in the titles, they're copied from another shell script action).

Actions Screenshot (click to expand/collapse)

I’ve searched around the forum about unzipping files via shell scripts but have not come with anything, and I’ve searched elsewhere for the issue but since it’s Keyboard Maestro specific I’ve had no success there either.

Any ideas why I‘m getting these errors? Thanks in advance for any help!


The files in an archive get extracted into the current working directory. You're getting the errors because the current working directory of a shell script action is the root directory, /, and you're not allowed to write there.

Use a cd command in your shell script action to move somewhere you're allowed to write before you unzip.

How do I know shell script actions start in /? I created a macro that runs pwd and sent the output to a window.

1 Like

Use ~/TEMP instead of /Users/your-name/TEMP

1 Like

Thanks! I realized this morning that neither tar nor unzip extract the files to their current directory... but the current working directory like you said. I appended the tar command with -C ${path to output} and it works brilliantly.

(This morning I also ran a shell script with pwd to figure out what was going on :sweat_smile:)