Details of issue here https://youtrack.jetbrains.com/issue/TBX-2540
When Jetbrains Toolbox auto updates PHPStorm, it creates a new app in a new location rather than overwriting the same location. This means file associations are lost everytime you update. This script aims to re add your file extensions everytime Toolbox updates PHPStrom.
brew install duti
Copy the following to a sh file somewhere e.g. /some-path/phpfix.sh. Edit to taste.
duti -s com.jetbrains.PhpStorm tsx all
duti -s com.jetbrains.PhpStorm ts all
duti -s com.jetbrains.PhpStorm js all
duti -s com.jetbrains.PhpStorm json all
duti -s com.jetbrains.PhpStorm md all
chmod +x /some-path/phpfix.sh
touch ~/Library/LaunchAgents/phpStorm.fix
Copy the following to ~/Library/LaunchAgents/phpStorm.fix
<?xml version=“1.0” encoding=“UTF-8”?>
<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=“1.0”>
<dict>
<key>Label</key>
<string>phpStorm.fix</string>
<key>ProgramArguments</key>
<array>
<string>/some-path/phpfix.sh</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Users/<YOUR_MAC_USER>/Applications/JetBrains\ Toolbox/PhpStorm.app/Contents/Info.plist</string>
</array>
</dict>
</plist>
launch the above plist.
launchctl load ~/Library/LaunchAgents/phpStorm.fix
https://apple.stackexchange.com/questions/91522/change-file-association-in-terminal https://github.com/moretension/duti