Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't shell scripts in Shortcuts see my utilities?

Tags:

macos

shortcut

i tried using shortcuts. i wanted to run scripts there, but i constantly get an error that the brew utility was not found. it feels like the scripts run in isolation.

i tried use

  1. brew link php
  2. eval 'brew link php'
  3. sh fileWithMyScript.sh

and always got error. how to fix it?

enter image description here

enter image description here enter image description here

like image 489
Georgii Avatar asked Sep 07 '25 02:09

Georgii


1 Answers

The brew command is not in macOS default PATH. You will either have to use the full path to the command or set PATH before calling the command:

/opt/homebrew/bin/brew link php
PATH=$PATH:/opt/homebrew/bin brew link php
PATH=$PATH:/opt/homebrew/bin cd ~/utils && sh php_8.1.sh

Use a different directory than /opt/homebrew/bin if homebrew is installed elsewhere.

like image 165
Rudedog Avatar answered Sep 08 '25 23:09

Rudedog