mac-sudo-prompt
Run a macOS command using sudo
, prompting the user with an OS dialog if necessary. Refactor of the macOS portion of sudo-prompt.
Installation
Install the package from npm using your package manager (I recommend pnpm):
pnpm add mac-sudo-prompt
Usage
import { macSudoPrompt } from 'mac-sudo-prompt';
const { stdout, stderr } = await macSudoPrompt('echo "hello"');
console.log([stdout, stderr]); // Output: ['hello\n', '']