#/bin/bash
VOLUME=`echo y | hdiutil attach $1 | grep Volumes | awk '{print $3}'`
APP_NAME=`ls $VOLUME | grep .app`
cp -rf $VOLUME/$APP_NAME /Applications/$APP_NAME
xattr -c /Applications/$APP_NAME
hdiutil detach $VOLUME
E.G: sudo sh my_inst.sh xxx.dmg
xattr -c *.app 是删除所有扩展属性,解决问题“App can’t be opened because it is from an unidentified developer”
注:本文主要来自走向自由,若有侵权请及时联系本人删除。