1. Home
  2. Mac OS X
  3. Open terminal in a directory on macos

How to open Terminal in a directory on macOS

When you run commands in Terminal, you may need to run them in a particular folder on your system. You can use the cd command to go to any folder you want to work in. If you want a faster way to open Terminal in a directory, you can use a free, open source app called OpenInTerminal. It’s a Finder add-on that can open Terminal in the current folder with the click of one button.

Open Terminal in directory

Download and run OpenInTerminal. Run the app and grant it the permission it needs to run. You will first be prompted to select which app you use to access the Terminal. The options it offers are; the default Terminal app, iTerm, and Hyper.

After you select the default Terminal app, you will be asked to give the app the special permission it needs to run. Next, move the app to the Applications folder. Finally, hold down the Command key and drag and drop the app icon on to the Folder’s toolbar. Once it’s added, it will appear on the toolbar whenever you open Finder.

To open Terminal in a folder, all you have to do now is click the button that OpenInTerminal added. Doing so will open the app and you can run commands in it.

Removing the app

Removing OpenInTerminal is simple enough i.e., you delete it from the Applications folder however, you have to first remove it from the Finder toolbar. To do that, open Finder and go to View>Customize toolbar in the menu bar.

When the customization panel appears, click and drag OpenInTerminal’s icon out of the toolbar and drop it onto the panel. That will do the trick.

Using the CD command

Using the CD command in Terminal is pretty easy and it follows the same syntax that you use on Windows in the command prompt.

Syntax

cd path-to-folder

Example

cd ~/Documents

While we’re on the topic of Windows and Command Prompt, you can easily open a command prompt in any folder on Windows 10 by typing cmd in the location bar in File Explorer. It doesn’t run with admin rights which makes it less useful but it’s a neat trick nevertheless.

With Terminal, when you run a command that requires admin rights, you’re asked to enter the password to the admin account. In some cases, it may not work and you may have to open Terminal the traditional way and cd to the folder you have to work in.