Skip to content

Instantly share code, notes, and snippets.

@tuxity
Last active May 13, 2024 17:44
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 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
"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"
@Kumarjit88
Copy link

my trial period is already over how to make this work anyone please help

@yuanzhuohao
Copy link

@Kumarjit88 You could run this bash shell again, and use crontab command to set a schedule task.

@DuoTunlH
Copy link

I don't think it's works anymore with version 16.3.3

@keynerajs93
Copy link

@Ttou @Danydeidei following the script manually works, I did it with 16.3.1. I will fix regex script later

16.3.2 not working on windows 11 can you help please

@manarsalhab For win try this

@tuxity
Copy link
Author

tuxity commented Dec 19, 2023

Just tested with 16.3.4 on macOS and it is working. This script is NOT for windows.

@namchosac
Copy link

It works with my mac mini, MacOS 16.6.3.

@copyorpaste
Copy link

m2 Mac doesn't work. version 16.3.7

@ahmedsafadii
Copy link

ahmedsafadii commented Mar 27, 2024

Not works anymore 16.3.5 intel

@mohammad-erdin
Copy link

still working on 16.3.7 for m1.

@yuanzhuohao
Copy link

still working on 16.3.7 for m1.

Thanks. I'm upgrading version now.

@copyorpaste
Copy link

need sudo

@w-Bro
Copy link

w-Bro commented Apr 11, 2024

still working on 16.3.7 for m1.

still working? not working for me.16.3.7, too.

@mehmetsahindev
Copy link

working on 16.3.7. Thanks

@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.

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