Opening Sublime Text from CLI | Generated by AI

Home 2025.10

Opening Sublime Text from the Command Line (CLI)

Sublime Text doesn’t include a built-in sublime (or subl) command by default on macOS (which it sounds like you’re using, based on the open -a reference). However, there’s an official and straightforward way to add it using Sublime’s bundled subl script. This is cleaner than relying on the open command. I’ll walk you through the options below, starting with the recommended approach.

Sublime Text includes a subl executable in its app bundle that you can symlink to a directory in your PATH (like /usr/local/bin). This lets you run subl . (to open the current directory) or subl file.txt from anywhere in the terminal.

Steps for macOS (Sublime Text 3 or 4):

If the symlink path doesn’t work (e.g., due to version differences), check the exact location:

Why this is nice:

If you’re on Linux or Windows:

2. Fallback: Use the open Command (No Installation Needed)

If you don’t want to mess with symlinks or PATH, macOS’s built-in open command works great for basic use. It’s already available everywhere.

Pros/Cons:

Troubleshooting

This should get you up and running nicely! If you run into errors or specify your OS/version, I can refine the steps.


Back

x-ai/grok-4-fast

Donate