Skip to main content

Installed on a new machine, now can't open .md files

Completed

Comments

22 comments

  • Fletcher Penney

    You have another application installed that is “hijacking” the UTI for `.md` files.  Presumably, this UTI is not properly specifying that the underlying file is in fact text, as Composer should open anything that resolves to  `public.text` as well.

     

    In the terminal, try `mdls <your filename>.md` and see what shows up.  Otherwise see what the default application for `.md` files is, and try deleting that application.

     

    To my knowledge, there is no way to control which application “wins” for a given file extension, and if one application defines their UTI poorly, it can interfere with other applications.

    0
  • theofrancis

    Hi. I've deleted BBEdit (which had been the default) and the same problem continued. 

    So I deleted MMD Composer 5 and then reinstalled it (without reinstalling BBEdit); I am still having the same problem.

    EDIT: The lipsum.md file referenced below was created in MMD Composer 5 (Version 5.0.0 (2023.06.08.16.13)), saved from there and closed; then I tried to reopen it immediately from within MMD Composer 5. It contains the following text without any formatting:

    > Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Libero enim sed faucibus turpis in eu mi bibendum neque. Turpis massa sed elementum tempus egestas sed sed. Id semper risus in hendrerit gravida rutrum quisque non. Aenean pharetra magna ac placerat vestibulum lectus mauris ultrices eros. Cras semper auctor neque vitae tempus quam pellentesque. In nisl nisi scelerisque eu. Commodo nulla facilisi nullam vehicula ipsum. Volutpat consequat mauris nunc congue. Malesuada nunc vel risus commodo viverra maecenas. Et egestas quis ipsum suspendisse. Ac placerat vestibulum lectus mauris. Diam donec adipiscing tristique risus nec feugiat.

     

    EDIT 2: Here's the contents of mdls in the terminal:

     

    ```

    _kMDItemDisplayNameWithExtensions      = "lipsum.md"

    kMDItemContentCreationDate             = 2023-07-03 14:37:16 +0000

    kMDItemContentCreationDate_Ranking     = 2023-07-03 00:00:00 +0000

    kMDItemContentModificationDate         = 2023-07-03 14:37:16 +0000

    kMDItemContentModificationDate_Ranking = 2023-07-03 00:00:00 +0000

    kMDItemContentType                     = "net.daringfireball.markdown"

    kMDItemContentTypeTree                 = (

        "net.daringfireball.markdown",

        "public.text",

        "public.data",

        "public.item",

        "public.content"

    )

    kMDItemDateAdded                       = 2023-07-03 14:37:16 +0000

    kMDItemDateAdded_Ranking               = 2023-07-03 00:00:00 +0000

    kMDItemDisplayName                     = "lipsum.md"

    kMDItemDocumentIdentifier              = 0

    kMDItemFSContentChangeDate             = 2023-07-03 14:37:16 +0000

    kMDItemFSCreationDate                  = 2023-07-03 14:37:16 +0000

    kMDItemFSCreatorCode                   = ""

    kMDItemFSFinderFlags                   = 0

    kMDItemFSHasCustomIcon                 = (null)

    kMDItemFSInvisible                     = 0

    kMDItemFSIsExtensionHidden             = 0

    kMDItemFSIsStationery                  = (null)

    kMDItemFSLabel                         = 0

    kMDItemFSName                          = "lipsum.md"

    kMDItemFSNodeCount                     = (null)

    kMDItemFSOwnerGroupID                  = 20

    kMDItemFSOwnerUserID                   = 503

    kMDItemFSSize                          = 708

    kMDItemFSTypeCode                      = ""

    kMDItemInterestingDate_Ranking         = 2023-07-03 00:00:00 +0000

    kMDItemKind                            = "text document"

    kMDItemLastUsedDate                    = 2023-07-03 14:38:36 +0000

    kMDItemLastUsedDate_Ranking            = 2023-07-03 00:00:00 +0000

    kMDItemLogicalSize                     = 708

    kMDItemPhysicalSize                    = 4096

    kMDItemUseCount                        = 7

    kMDItemUsedDates                       = (

        "2023-07-03 04:00:00 +0000"

    )

    kMDItemUserCreatedDate                 = (

        "2023-07-03 14:37:16 +0000"

    )

    kMDItemUserCreatedUserHandle           = (

        503

    )

    ```

    0
  • Fletcher Penney

    There might be another application changing the UTI, but I am trying some changes to the UTI definitions in the next version to see if makes the app more "resilient."

     

    In meantime can also try changing file extension to txt.

    0
  • Fletcher Penney

    The new build from today *might* behave better for you.  Let me know.

    0
  • Hugh Collins

    I wasn't having this behaviour before, but with the latest build, I am. Although it insists .md files are “data” and it seems that TextEdit has hijacked all .md files

    0
  • Hugh Collins

    Just realised the problem. In MMD settings the default file save is set to md rather than .md

    I changed that and it is saving as a Markdown file again. FYI, I always leave the defaults as is.

    0
  • Fletcher Penney

    Hugh Collins  – Those two things are not related.  The default file extension in the preferences dialog should be `md`, not `.md` (or any other desired file extension, of course).  Using `.md` will cause the default file name to be something like `filename..md`, which will still effectively have the file extension `md`, just with an extra period in the filename.

    If the problem recurs, can you send me the output of `mdls your_file_name.file_extension` from the Terminal?

    0
  • Hugh Collins

    Terminal output was sent, but I really didn't know what I was doing!

    There are no signs of ..md anywhere. MMD5 seems to save without any extension and will not reopen a file once closed. It will open any other MarkDown file correctly. Changing the default setting from md to .md sees it operating as expected with a file extension of .md and the resultant files can be opened by MMD4.5.12 and the files appear in Terminal with Get Info showing MMD5 as the default app. 

    PS. Apologies for cluttering this thread with a different problem

    0
  • Fletcher Penney

    I sent some instructions to try and help with the terminal.

    Can you send me one of your files that you state has no file extension despite the preferences set to use `md`?

    0
  • Hugh Collins

    My laptop is an 2022 M2 MacBook Air and I was wondering what would happen if I installed MMD5 on my wife's 2019 Intel MacBook Air. I downloaded it from the thread above, obviously out of date, but it updated and appeared fine. That also appears to save something that once saved will not reopen. It will open existing MarkDown files though. Interestingly adding .md in settings, rather than md doesn't have any effect on the output. 

    0
  • Fletcher Penney

    Hugh Collins  – I had to confirm some of the basics (I've found that fairly often it's the simple assumptions that screw up the debugging process…).  The file you sent has no extension (it's not just hidden).  And the `mdls` output, as expected, confirms that a file with no extension has no associated file type and is therefore treated as just `data`.

    So the issue is why your machine is defaulting to an empty file extension when saving.

    The code that assigns the default file type based on the preferences has not been changed in years, and the general approach I use has not been change in over a decade.  So it's highly unlikely that it just spontaneously “broke.”  (And it still works as expected for me.)

    I just pushed a new update to fix a bug in the Troubleshooting preferences.  Once you upgrade, can you use the “Export Application Defaults” button in the Troubleshooting prefs and send that file to me?  Before doing so, set the file extension back to the default `md` that doesn't work for you.  Thanks!!

    0
  • Fletcher Penney

    I had one more thought, and am exploring a different possibility.

    Can you do the `mdls filename.extension` on a file with the `md` file extension and send it to me?  Even if you have to rename the file in the Finder so that it has the proper extension.  Thanks!

    0
  • Fletcher Penney

    Hugh Collins  –  I think I found the issue, and it's more subtle than I expected.  I'll post an update (and a new build) when i think I have it fixed so you can confirm.

     

    Thanks!!

    0
  • Fletcher Penney

    Hugh Collins  – I just pushed a new build (2023.08.06…).  I *think* this should fix the problem you are having, and hopefully doesn't break any fix for others.

    Let me know what happens when you try it.

     

    Thanks!!

    0
  • Hugh Collins

    Updated to the latest build and whatever I do the output is without an .md extension. I have sent output from Terminal on a file produced without an extension, but I added .md using Finder. 

    One change I have noticed is that when I pressed save on a new file in the previous build “Untitled.” appeared, but in the new build “Untitled” appears.

    When I open a previously saved md file and save as an OPML, or HTML file it works, but not as an md file

    0
  • Fletcher Penney

    Hugh Collins  -- Do you mean in the dialog box?  The extension does not appear in the dialog box (by default anyways).  Default extension in preferences should be `md`.  The file format should be “MultiMarkdown Text Document”.

    The default file name should be “Untitled” without a period. (Unless you enable suggested file names.)

    I just tried it again and it still works properly.

    If you want more “debugging” information, you can use the pop-up menu button in the toolbar of the save panel to disable the “Hide Extension” option.  It will then always (I think) show you the file extension as part of the file name.

    0
  • Hugh Collins

    When I said output is without an .md extension, I should have said the file produced had no associated file type at all when trying to save as MultiMarkdown Text Document, but the OPML & HTML options work correctly

    0
  • Hugh Collins

    Brilliant! Disabling the “Hide Extension” option gave me the information I needed. That, together with running Onyx was enough to bring back the .md extension. The only thing I have to do on both our laptops is to figure out why any file saved with MMDComposer5 has the right extension but shows everywhere with the txt icon. If you pick an md file in Finder and Get Info the correct icon shows. A small problem though…

    Thanks for all your help. 

    0
  • Fletcher Penney

    The file icon is determined by macOS based on the UTI, which is determined by an unknown (to me anyway) algorithm based on the UTI definitions of all installed apps.  The information you sent earlier showed that you have IA Writer installed, and it had priority for defining the UTI for files with `md` file extension.  You could uninstall it if you no longer use it.  Or just accept the fact that the icon doesn't really matter, and that you can assign your desired default application regardless of the icon.

     

    Glad it's working for you!

    0
  • Fletcher Penney

    theofrancis  – are you still having issues with this, particularly with the latest release (yesterday)?

    0
  • theofrancis

    Hi. My apologies for not helping out more; I wound up mostly offline for several months and have been catching back up with life and work. 

    However, I updated MMDComposer5 this week, and needed to use it quite a bit in the last day or two. The recent round of fixes appears to have resolved the problems I was having. I also re-installed BBEdit (which at one point looked like it might be causing problems), and everything is still working like it's supposed to. 

    Thank you, Fletcher Penney and Hugh Collins  for the master-class in pinning down (and fixing!) a confusing conflict.

    0
  • Fletcher Penney

    theofrancis  – no worries!  Thanks for responding, and glad that this issue seems to have fixed the problem.

     

    I'll close this issue.  A new one can be opened if a similar problem recurs.

    0

Please sign in to leave a comment.

Powered by Zendesk