Created
May 18, 2024 00:23
-
-
Save Brugarolas/f001dbbd20736a19daf604bd844ecfa2 to your computer and use it in GitHub Desktop.
Reset the free trial period in JetBrains products for Mac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ "$1" = "--prepare-env" ]; then | |
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
| mkdir -p ~/Scripts | |
| echo "Copying the script to $HOME/Scripts" | |
| cp -rf $DIR/runme.sh ~/Scripts/jetbrains-reset.sh | |
| chmod +x ~/Scripts/jetbrains-reset.sh | |
| echo | |
| echo "Copying com.jetbrains.reset.plist to $HOME/Library/LaunchAgents" | |
| cp -rf $DIR/com.jetbrains.reset.plist ~/Library/LaunchAgents | |
| echo | |
| echo "Loading job into launchctl" | |
| launchctl load ~/Library/LaunchAgents/com.jetbrains.reset.plist | |
| echo | |
| echo "That's it, enjoy ;)" | |
| exit 0 | |
| fi | |
| if [ "$1" = "--launch-agent" ]; then | |
| PROCESS=(clion idea webstorm datagrip phpstorm nova pycharm goland rubymine rider) | |
| COMMAND_PRE=("${PROCESS[@]/#/MacOS/}") | |
| # Kill all Intellij applications | |
| kill -9 `ps aux | egrep $(IFS=$'|'; echo "${COMMAND_PRE[*]}") | awk '{print $2}'` | |
| fi | |
| # Reset Intellij evaluation | |
| #for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine Rider; do | |
| for product in Rider; do | |
| echo "Resetting trial period for $product" | |
| # echo "removing evaluation key..." | |
| # rm -rf ~/Library/Preferences/$product*/eval | |
| # Above path not working on latest version. Fixed below | |
| rm -rf ~/Library/Application\ Support/JetBrains/$product*/eval/*.key | |
| # echo "removing all evlsprt properties in options.xml..." | |
| # sed -i '' '/evlsprt/d' ~/Library/Preferences/$product*/options/other.xml | |
| # Above path not working on latest version. Fixed below | |
| sed -i '' '/evlsprt/d' ~/Library/Application\ Support/JetBrains/$product*/options/other.xml | |
| echo | |
| done | |
| echo "removing additional plist files..." | |
| rm -f ~/Library/Preferences/com.apple.java.util.prefs.plist | |
| rm -f ~/Library/Preferences/com.jetbrains.*.plist | |
| rm -f ~/Library/Preferences/jetbrains.*.*.plist | |
| for f in ~/Library/Preferences/jetbrains.*.plist; do | |
| if [[ -f $f ]]; then | |
| fn=${f##*/}; key=${fn%.plist} | |
| echo delete $key from pref and file $f | |
| defaults delete "${fn%.plist}" 2>/dev/null && rm "$f" | |
| fi | |
| done | |
| echo | |
| echo "That's it, enjoy ;)" | |
| # Flush preference cache | |
| if [ "$1" = "--launch-agent" ]; then | |
| killall cfprefsd | |
| echo "Evaluation was reset at $(date)" >> ~/Scripts/logs | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Didn't work for me :(