Quick Open Command Line#
As a developer who frequently uses Mac, there is often a need to quickly open the command line in the Finder folder and enter the current folder. And if you use Xcode, there is usually another requirement to quickly open the command line in Xcode and enter the current project.
Ps: The command line tool demonstrated below uses Warp
, but the system's Terminal
also supports it.
Quickly Open Command Line in Finder Folder#
Open System Preferences, find Keyboard
, and then click Keyboard Shortcuts
, as shown in the figure below:
Then find Services
, expand Files and Folders
, check Open folder with Warp
, double-click on the position of none
on the right side, enter the shortcut key, and then click Done. From now on, you can quickly open Warp
using this shortcut key, as shown in the figure below:
Open any folder in Finder, and then press the shortcut key you just entered. You will find that Warp
is quickly launched from the current directory and enters the current folder.
Quickly Open Command Line in Xcode#
To quickly open the command line in Xcode, use Awesome-Xcode-Behaviors
- First, download Awesome-Xcode-Behaviors and unzip it to a specified folder.
- Then enter this folder and authorize
chmod -R +x "Pods/" "Gem/" "Open Application/"
to execute. - Open
Xcode
settings, select theBehaviors
tab, click the + button in the bottomCustom
section, enter the name of thisBehavior
on the left, and then double-click theCMD
after the name to set the shortcut key that triggers thisBehavior
. Scroll to the bottom right, checkRun
, and then clickChoose Script
to select the unzipped Awesome-Xcode-Behaviors, as shown in the figure below:
- Open any project, and then trigger the shortcut key you just set to see the command line directly opened from the current directory.
Ps:
After downloading and unzipping Awesome-Xcode-Behaviors, you can see the contents inside. Among them, Open Application
refers to quickly opening applications. You can see that it supports quickly opening iTerm
, Terminal
, etc., or you can customize it yourself. open-warp.sh
is the one I added. The other folders are for other quick commands. Under the Carthage
folder, there are carthage archive
, carthage clean
, etc. The Gem
folder is for gem
related operations, and the Pods
folder is for pod
related operations. All of these can be set as shortcut keys through Behavior
to execute quickly.
For example, setting Behavior
to quickly trigger pod install
and pod update
, when adding or modifying Pod
libraries, you can directly execute pod
related operations by simply pressing the shortcut key, without having to open the command line and enter the relevant commands, making it convenient and efficient.