简体   繁体   中英

How to change terminal in Qt Creator?

How to set iterm2 as a terminal in Qt Creator? When I click on "open terminal here" it opens the Mac OS default terminal. How could I change it to open eg iterm2 instead?

在这里打开终端

Seeing you are on OSX, you can use the solution I posted here . You can create a new script to open a new iTerm2 window, then execute a command/script.

For convinience, here is a copy of my answer:


First, create a script (let's say ~/newiTerm.sh ) and put the following content

 #! /bin/bash # ugly escaping: for apple script \\ and " need to be escaped, whereas %q takes care of all bash escaping declare -a args mydir=`pwd` mydir=$(printf '%q' "$mydir") mydir="${mydir//\\\\/\\\\\\\\}" args[0]="cd ${mydir//\\"/\\\\\\"};" for a in "$@" ; do x=$(printf '%q ' "$a") x="${x//\\\\/\\\\\\\\}" args[${#args[@]}]="${x//\\"/\\\\\\"}" done mArgs=${args[@]:0} osascript <<EOF set cdScript to "$mArgs" tell application "iTerm2" set newWindow to (create window with default profile) tell newWindow select set _session to current session tell _session write text cdScript end tell end tell end tell 

Then, go to Qt Preferences ( ⌘, ) > Environment > System > Terminal and set the value to ~/newiTerm.sh

Cheers

Note - Make sure you have permission for the shell script. You need to give proper permission, something like this chmod a+x ~/newiTerm.sh . Otherwise, QT won't able to run it.

设置窗口画面

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM