Set SublimText 3 as default app for files without extension [duplicate]
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 :
- Save & Reboot
Another way to do it
- Without Xcode
- Working on macOS Mojave
- With Sublime Text 4
- Convert binary plist to xml plist (for easy editing)
plutil \
-convert xml1 \
~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist \
-o ~/Desktop/plist.xml
- Open
plist.xml
(on your Desktop) with Sublime Text
Add 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>
- Convert back from XML to binary plist
plutil \
-convert binary1 \
~/Desktop/plist.xml \
-o ~/Desktop/com.apple.launchservices.secure.plist
- Move the new
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/
- Reboot
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.