Jump to content
djurgensen

App "Sublime Text" does not show in the open dialog menu for files with a .log ext on Mac Os

Recommended Posts

djurgensen    5

I originally posted this on the Sublime Text forum in hopes of getting some feedback, but so far none has come. So I am posting here to the Maccast forum to see if anyone else can use this information, or if anyone else has any better ideas.

I am on Mac Os Sierra, running Sublime Text build 3126. A number of file extensions work correctly, i.e. right-click on a .java file or .json file and I see Sublime Text in the open with dialog. However if I do the same with a file ending in .log, Sublime Text doesn't appear and I have to select Other and locate Sublime Text from items in the applications folder.

I have fixed this on my machine but it may not survive an update and maybe there is a "Sublime Text" way of accomplishing this. Here is what I did.

I went to the Sublime Text.app, did show package. Then I went into Contents and edited info.plist, and yes I had backups :)
I changed the following adding the log extension:
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeName</key>
<string>Plain Text</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>txt</string>
<string>log</string
</array>
<key>CFBundleTypeIconFile</key>
<string>TEXT</string>
</dict>

Then I did lsregister -f /Applications/Sublime\ Text.app
so that it would re-read the info.plist and add the log extension and I can now right click on a .log file and have it opened from the menu without the extra work of having to look through the Applications.

Thanks for you time in advance.

Share this post


Link to post
Share on other sites
johnfoster    48

did you try the Command-I "Open with:" then click the Change All button?

 

 

 

 

Screen Shot 2017-04-28 at 1.32.21 PM.png

  • Like 1

Share this post


Link to post
Share on other sites
MacCast    80

Both of these answers are correct, but in different ways. The one @johnfoster is recommending will mean that the `.log` files will always open with Sublime Text as the default (may or may nor be what you want). Chances are though that without the fix @djurgensen describes Sublime Text would not even show up in the 'Open With:' list (at least not as a "recommended" application). The PLIST hack he describes is needed so OS X even knows that Sublime Text is a valid app for opening `.log` files. Of course that's just for the 'show recommend' list. You could always select the 'Show all' or 'Other…' from the dropdown and choose any app you want.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing

    No registered users viewing this page.

  • Who's Online (See full list)

    There are no registered users currently online

×