MacBook – Why css files are opening in safari by default in MacBook

cssmacbook protextedittextmate

I do not know what happened to my MacBook, but all the css files are appearing with the web browser icon as you can see in the following image. When I open it it is opening in safari instead of TextEdit/other any editor. This is not happening with other file like .php, .twig, .yml, those all are opening in Text file?

Any idea why this is happening and how to correct that? Besides, in-built TextEdit of Mac, I am also using TextMate Editor(latest version 2.0).

enter image description here

Best Answer

I don't know why it's happening, but the usual way to correct would be:

  • Select a CSS file
  • Press Cmd-I, or right-click and select "Get Info"
  • In the Information popup, locate the "Open With" dropdown, and select the application you want to open CSS files with.
  • To affect all CSS files, instead of just this one, click the "Change All..." button immediately below the "Open With" dropdown.

If that doesn't work, it can indicate a problem with the Launch Services Database, or some other corruption of a system cache or database which is probably fixable. But try that first.