Skip to content

Instantly share code, notes, and snippets.

@tuxity
Last active May 23, 2024 12:41
Show Gist options
  • Save tuxity/32b353f00b38fe41c64434b98fdee077 to your computer and use it in GitHub Desktop.
Save tuxity/32b353f00b38fe41c64434b98fdee077 to your computer and use it in GitHub Desktop.
Reset Navicat Premium 15/16/17 remaining trial days
#!/bin/bash
set -e
file=$(defaults read /Applications/Navicat\ Premium.app/Contents/Info.plist)
regex="CFBundleShortVersionString = \"([^\.]+)"
[[ $file =~ $regex ]]
version=${BASH_REMATCH[1]}
echo "Detected Navicat Premium version $version"
case $version in
"17"|"16")
file=~/Library/Preferences/com.navicat.NavicatPremium.plist
;;
"15")
file=~/Library/Preferences/com.prect.NavicatPremium15.plist
;;
*)
echo "Version '$version' not handled"
exit 1
;;
esac
echo "Reseting trial time..."
regex="([0-9A-Z]{32}) = "
[[ $(defaults read $file) =~ $regex ]]
hash=${BASH_REMATCH[1]}
if [ ! -z $hash ]; then
echo "deleting $hash array..."
defaults delete $file $hash
fi
regex="\.([0-9A-Z]{32})"
[[ $(ls -a ~/Library/Application\ Support/PremiumSoft\ CyberTech/Navicat\ CC/Navicat\ Premium/ | grep '^\.') =~ $regex ]]
hash2=${BASH_REMATCH[1]}
if [ ! -z $hash2 ]; then
echo "deleting $hash2 folder..."
rm ~/Library/Application\ Support/PremiumSoft\ CyberTech/Navicat\ CC/Navicat\ Premium/.$hash2
fi
echo "Done"
@ahmedsafadii
Copy link

Working like charm.

@samironbarai
Copy link

It works for Mac M1.

@keynerajs93
Copy link

keynerajs93 commented May 13, 2024

In case someone hasn't tried it, it doesn't work in version 17.0.5 on Mac M1.

@hasanbasri1993
Copy link

It works for Mac M2 and the latest version navicat premium.
add this line
"17") file=~/Library/Preferences/com.navicat.NavicatPremium.plist ;;

Become like this
image

In case someone hasn't tried it, it doesn't work in version 17.0.5 on Mac M1.

@tuxity
Copy link
Author

tuxity commented May 21, 2024

I edited the script to support new version 17 based on @hasanbasri1993 comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment