Created
December 11, 2023 17:38
-
-
Save Prajwal-Koirala/8991edb619b7bde7621442856c763aae to your computer and use it in GitHub Desktop.
Using `duti` to Open .json Files with VSCode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Using `duti` to Open .json Files with VSCode | |
This guide shows you how to use the `duti` command on macOS to associate the `.json` file extension with Visual Studio Code (VSCode). | |
**Prerequisites:** | |
* macOS | |
* `duti` command-line tool (pre-installed) | |
* VSCode installed | |
**Steps:** | |
1. **Open Terminal:** | |
* Press `Command + Space` to open Spotlight. | |
* Type `Terminal` and press Enter. | |
2. **Associate .json with VSCode:** | |
* Execute the following command in the Terminal: | |
``` | |
duti -s com.microsoft.VSCode .json all | |
``` | |
* This command tells macOS to use VSCode (identified by its bundle identifier `com.microsoft.VSCode`) to open all `.json` files. | |
3. **Optional: Verify the association:** | |
* In Finder, right-click on a `.json` file. | |
* Go to "Open With" and check if VSCode is listed as the default application. | |
* If not, select "Other..." and choose VSCode from the list. | |
* Check the "Always Open With" box to make VSCode the default application for `.json` files. | |
**Explanation:** | |
* `duti` is a command-line tool used to manage file type associations on macOS. | |
* `-s` specifies the application to set as the default. | |
* `com.microsoft.VSCode` is the bundle identifier for VSCode. | |
* `.json` specifies the file extension to associate. | |
* `all` indicates that the association should apply to all files with the specified extension. | |
**Additional Notes:** | |
* If you have multiple applications installed that can handle `.json` files, you can use `duti -l` to see the current associations. | |
* You can also use `duti -d` to remove an existing association. | |
* This guide assumes you have VSCode installed. If you haven't installed it yet, you can download it from the official website: [https://code.visualstudio.com/download](https://code.visualstudio.com/download) | |
**Useful Resources:** | |
* `duti` man page: [https://developer.apple.com/developer-id/](https://developer.apple.com/developer-id/) | |
* VSCode documentation: [https://code.visualstudio.com/docs](https://code.visualstudio.com/docs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment