Skip to content

Instantly share code, notes, and snippets.

@malash
Last active November 22, 2023 17:06
Show Gist options
  • Save malash/57759401fd6fd853b9c0fe55f80f29fc to your computer and use it in GitHub Desktop.
Save malash/57759401fd6fd853b9c0fe55f80f29fc to your computer and use it in GitHub Desktop.
Drag `.app` to this sheel to fix run issue for macOS
#!/bin/bash
echo "Drag \`.app\` to this shell or press enter to quit:"
echo -n "> "
read line
if [ -z $line ]; then
exit 0
fi
file=`realpath $line`
echo "Cleaning xattr..."
xattr -d com.apple.quarantine $file >/dev/null 2>&1
xattr -p com.apple.quarantine $file >/dev/null 2>&1
if [ $? == 1 ]; then
echo "Success!"
else
echo "Failed!"
fi
echo "Run ad hoc signing..."
codesign --force --deep -s - $file
codesign -v $file
if [ $? == 0 ]; then
echo "Success!"
else
echo "Failed!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment