Using jq to parse JSON in launchd

后端 未结 2 672
长情又很酷
长情又很酷 2021-01-24 06:04

I have a shell script that evaluates a folder full of JSON files which runs fine when invoked directly but fails when run from launchd. Specifically, launchd fails on this line:

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-24 06:25

    Ahh, looks like I assumed that launchd shared the same PATHs as my normal bash shell. Explicitly spelling out where JQ lives seemed to work:

    So at the top of the file I added:

    JQ=/usr/local/bin/jq
    

    and replaced all instances of 'jq' with:

    $JQ
    

提交回复
热议问题