Files without extension always open in TextEdit ... I want them to open in SublimText 3
I tried to change my com.apple.launchservices.secure.plist, but simply adding public.text did not work ...
Files without extension always open in TextEdit ... I want them to open in SublimText 3
I tried to change my com.apple.launchservices.secure.plist, but simply adding public.text did not work ...
The solution was doing it with public.data
Go to ~/Library/Preferences/com.apple.LaunchServices
Open com.apple.launchservices.secure.plist with Xcode
Add this :
Another way to do it
plutil \
-convert xml1 \
~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist \
-o ~/Desktop/plist.xml
plist.xml (on your Desktop) with Sublime TextAdd inside <array>
<dict>
<key>LSHandlerContentType</key>
<string>public.data</string>
<key>LSHandlerPreferredVersions</key>
<dict>
<key>LSHandlerRoleAll</key>
<string>-</string>
</dict>
<key>LSHandlerRoleAll</key>
<string>com.sublimetext.4</string>
</dict>
plutil \
-convert binary1 \
~/Desktop/plist.xml \
-o ~/Desktop/com.apple.launchservices.secure.plist
com.apple.launchservices.secure.plist, from your Desktop to ~/Library/Preferences/com.apple.LaunchServices/mv ~/Desktop/com.apple.launchservices.secure.plist \
~/Library/Preferences/com.apple.LaunchServices/
You can also use Sublime package Plist Binary or BinaryPlist instead of manually converting from binary to XML
Copy paste script (working with catalina):
defaults write ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}' '{LSHandlerContentType=public.unix-executable;LSHandlerRoleAll=com.sublimetext.3;}'
This sets the default to Sublime Text 3. If you want to have any other app you have to simply replace com.sublimetext.3 with the app id of your favorite app.
.plistfile can be edited with any text editor, such as SublimeText, for instance! ;) – Thecafremo Oct 01 '17 at 22:42com.apple.launchservices.secure.plistfile is a binary plist file and while Sublime Text can open it, it does so in hex mode and as such cannot be edited in the manner proposed in this answer. If it was an XML plist file, then it could. – user3439894 Oct 02 '17 at 18:54BinaryPlistthat does automatic conversion between binary and plain text. – Joel Mellon Jan 09 '20 at 23:38