In Windows 10, you can open cmd in any folder by typing cmd in the location bar in File Explorer or just hold down the Shift key and right-click in the explorer window. In the context menu, you will see the option to Open command window here. However, there is no such option to quickly open Terminal on Mac. When you open a terminal on Mac, it always opens in the home directory, but there are times when you may need to open it in a particular folder on your system. It turns out that you can also open Terminal in any directory on macOS. There are three ways to do it.
- Use the cd command
- Use the built-in Mac shortcut
- Use a third party app
Read: How to install YouTube-dl on Mac
Quickly navigate to a folder in Terminal on Mac
This is the most common method.
Just open the terminal, type the command cd followed by the path of the folder you want to navigate. For example,
Alternatively, if you’re too lazy to type the full pathname, you can also drag a folder (or pathname) onto the Terminal app icon. It will automatically take the folder path, then hit enter.
While the above method works, it is not the most efficient way to navigate to a folder in terminal on Mac.
Like Windows, Mac also allows you to open the terminal directly from a specific folder. However, this option is buried deep in Mac settings. Let’s see how to fix it.
To get started, go to System Preferences> Keyboard> Shortcuts> Services.
Find “New Terminal in Folder” in settings and click on the box.
The good thing is that these Services work in all applications, not just Finder. You can also assign a keyboard shortcut to it. But I don’t recommend doing that, as the keyboard shortcut can conflict with other native shortcuts.
Now when you are in Finder, just right click on a folder, go to Services and you will see a new option: New terminal in folder. Clicking which one will open Terminal in the current folder
Alternatively, you can use many of the third-party applications available to navigate to a folder in the terminal. The one I recommend is cdto Y OpenInTerminal.
For this article, we will use the OpenInTerminal application. It is free and open source.
To get started, download OpenInTerminal. At the time of writing, the latest version is OpenInTerminal-Lite 0.4.1.
Once downloaded, head over to the app, unzip it, and move it to the Applications folder.
Now, you need to add OpenInTerminal-Lite to your browser’s toolbar. To do this, hold down the Cmd key and drag the application to the Finder toolbar.
Once this is done, the application shows you a small icon in the browser window, clicking on it will open Terminal in the current folder.
And that’s it.
Now to remove OpenInTerminal, you must first remove it from Finder toolbar before removing it from Applications folder. To do this, open the Finder and go to View> Customize Toolbar. A new window will open, click and hold the OpenInTerminal icon and drag it off the toolbar to remove it from the toolbar. Now, you can go ahead and delete the original application from the Application folder.
Generally these were some ways to navigate to a folder in terminal on Mac, although it is not a live saver, it saves some time if you use terminal a lot. In general, I would recommend using the ‘New Terminal at Folder’ option as it is native to Mac or if you prefer the folder option, use the OpenInTerminal application. Let me know your thoughts in the comment section below.
Also read: Applications to bridge the gap between iPhone and MacBook