How to sudo command in xcode cloud ci_post_clone.sh?

I'm installing texturepacker in ci_post_clone.sh script using below command in Xcode Cloud workflow.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null

brew install --cask texturepacker

But I'm getting sudo warning in log.

==> Downloading https://www.codeandweb.com/download/texturepacker/6.0.2/TexturePacker-6.0.2.dmg
==> Installing Cask texturepacker
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
==> Purging files for version 6.0.2 of Cask texturepacker
Error: Permission denied @ dir_s_mkdir - /usr/local/Caskroom

How can i fix this issue? Any idea or suggestions would be appreciated.

Thank You

Hello there, I have the same problem. I wish someone will help us one day.

This article https://wojciechkulik.pl/xcode/xcode-cloud-overview-and-setup suggests putting these lines at the beginning of your script

echo 'export GEM_HOME=$HOME/gems' >>~/.bash_profile
echo 'export PATH=$HOME/gems/bin:$PATH' >>~/.bash_profile
export GEM_HOME=$HOME/gems
export PATH="$GEM_HOME/bin:$PATH"
How to sudo command in xcode cloud ci_post_clone.sh?
 
 
Q