Skip to content

Instantly share code, notes, and snippets.

@tuxity
Last active April 29, 2024 09:06
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"
@marcofoxx
Copy link

Thanks a lot, it's working on my Mac

@Wern-rm
Copy link

Wern-rm commented Jan 10, 2022

TY!

@chiendv
Copy link

chiendv commented Mar 7, 2022

works great!

@mohammad-erdin
Copy link

how do reset trial on ubuntu

how on ubuntu

my way to reset, tested on version 16

#!/bin/bash
dconf reset -f /com/premiumsoft/
rm -rf ~/.config/navicat/Premium/preferences.json*
~/apps/navicat16-premium-en.AppImage  # path of the navicat

save it to ~/apps/navicat_reset_trial.sh

then locate navicate.desktop or create one ~/.local/share/applications/navicat.desktop

[Desktop Entry]
Name=Navicat
Comment=Navicat MySQL Database Manager
Exec=~/apps/navicat_reset_trial.sh
Icon=~/apps/navicat.png # optiional
Terminal=false
Type=Application
Categories=Development
X-Desktop-File-Install-Version=0.24

@filipemontt
Copy link

filipemontt commented Jun 7, 2022

Macbook.
Version 16
Not working

#!/usr/bin/env bash

set -e

file=$(defaults read /Applications/Navicat\ for\ MySQL.app/Contents/Info.plist)

regex="CFBundleShortVersionString = \"([^\.]+)"
[[ $file =~ $regex ]]

version=${BASH_REMATCH[1]}

echo "Detected Navicat Premium version $version"

case $version in
    "16")
        file=/Users/myname/Library/Preferences/com.navicat.NavicatForMySQL.plist
        ;;
    "15")
        file=~/Library/Preferences/com.prect.NavicatPremium15.plist
        ;;
    *)
        echo "Version '$version' not handled"
        exit 1
       ;;
esac

echo -n "Reseting trial time..."

regex="([0-9A-Z]{32}) = "
[[ $(defaults read $file) =~ $regex ]]

hash=${BASH_REMATCH[1]}

if [ ! -z $hash ]; then
    defaults delete $file $hash
fi

regex="\.([0-9A-Z]{32})"
[[ $(ls -a /Users/myname/Library/Application\ Support/PremiumSoft\ CyberTech/Navicat\ CC/Navicat\ Premium/ | grep '^\.') =~ $regex ]]

hash2=${BASH_REMATCH[1]}

if [ ! -z $hash2 ]; then
    rm /Users/myname/Library/Application\ Support/PremiumSoft\ CyberTech/Navicat\ CC/Navicat\ Premium/.$hash2
fi

echo " Done"

Output

Detected Navicat Premium version 16
Reseting trial time... Done

But not reset date, and show to register.

@haveacess
Copy link

Thank you so much!

P.s I used this script with little modification for restore my trial period for Navicat for MySQL

@rvalenzuelaferrada
Copy link

mac mini M1
Navicat Version 16
works correctly

Thanks!

@alsocodes
Copy link

thanks you bro,
it works on my mac m2 navicat 16

@ikoko7
Copy link

ikoko7 commented Nov 30, 2022

How can I reset it on windows?

@Kisem
Copy link

Kisem commented Dec 9, 2022

How can I reset it on windows?

You should check out this repo:
https://github.com/wctsai20002/navicat-refresh

@tienn2t
Copy link

tienn2t commented Jan 18, 2023

working for Navicat for Mysql
#!/bin/bash

set -e

file=$(defaults read /Applications/Navicat\ for\ MySQL.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.NavicatForMySQL.plist
;;
"15")
file=
/Library/Preferences/com.prect.NavicatForMySQL.plist
;;
*)
echo "Version '$version' not handled"
exit 1
;;
esac

echo -n "Reseting trial time..."

regex="([0-9A-Z]{32}) = "
[[ $(defaults read $file) =~ $regex ]]

hash=${BASH_REMATCH[1]}

if [ ! -z $hash ]; then
defaults delete $file $hash
fi

regex=".([0-9A-Z]{32})"
[[ $(ls -a /Library/Application\ Support/PremiumSoft\ CyberTech/Navicat\ CC/Navicat\ for\ MySQL/ | grep '^.') = $regex ]]

hash2=${BASH_REMATCH[1]}

if [ ! -z $hash2 ]; then
rm ~/Library/Application\ Support/PremiumSoft\ CyberTech/Navicat\ CC/Navicat\ for\ MySQL/.$hash2
fi

echo " Done"

@ciciFbl
Copy link

ciciFbl commented Feb 1, 2023

Thank you very much, it's working on my Mac

@marbled-ky-pnt
Copy link

Thank you very much !!

@portenko
Copy link

portenko commented Apr 1, 2023

Thank you man!

@marquezmiguel
Copy link

any update for navicat 16 on macos?

@mannix-lei
Copy link

nice.

@almasbani
Copy link

almasbani commented Jun 5, 2023

How to run on mac? just run with terminal? @rvalenzuelaferrada

@rvalenzuelaferrada
Copy link

How to run on mac? just run with terminal? @rvalenzuelaferrada

@almasbani with the terminal you run bash navicat_reset_trial.sh
then you can create a cronjob to run the file automatically.

@PouLJenny
Copy link

thx bro!

@creasd
Copy link

creasd commented Jul 14, 2023

nice thx

@EMANUELGAR
Copy link

Works in Mac M1, thanks bro!

@yuanzhuohao
Copy link

It works for me to Navicat 16.2.9

@shahidkarimi
Copy link

It perfectly works on ubuntu 22.04

@yuhongdong9004
Copy link

It works! Thanks!

@Ttou
Copy link

Ttou commented Nov 1, 2023

16.3.1 not work

@Danydeidei
Copy link

Danydeidei commented Nov 14, 2023

I used your code on previous Navicat Premium versione and it works.
With the last Navicat Premium (16.3.2) and Navicat for Postgres (16.3.2) is not working
WIN 11

@tuxity
Copy link
Author

tuxity commented Nov 14, 2023

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

@Danydeidei
Copy link

thank you so much ;-)

@manarsalhab
Copy link

manarsalhab commented Nov 28, 2023

@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

@kissmevn
Copy link

I used your code on previous Navicat Premium versione and it works. With the last Navicat Premium (16.3.2) and Navicat for Postgres (16.3.2) is not working WIN 11

How can you run above sh script in windows ?

@tuxity
Copy link
Author

tuxity commented Nov 30, 2023

Tested with 16.3.2 on macOS Sonoma 14.1.1 with bash 5.2.15 installed with homebrew and it's working. I have added a bit more logs to help to see if the regex is working to catch the hashes.

This is for Navicat Premium ONLY, other versions are not supported.

@hsomezhang
Copy link

hsomezhang commented Dec 4, 2023

Thanks bro! It works on navicat 16 and macOS 14.1.1

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

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