1

When one uses the terminal inspector, one can change many properties of the terminal, such as background color, text color, and selection color.

How can I detect what these properties have been set to from the command line?

Is there some cache or file within "/Applications/Utilities/Terminal.app/Contents/Resources" that holds this information?

Thank you.

1

Terminal Preferences are stored in the com.apple.Terminal.plist file (/Users/$USER/Library/Preferences/com.apple.Terminal.plist) and while it can be read using the defaults command, nonetheless much of it may not be discernible.

Copy and paste the following command into a Terminal and then press Enter:

defaults read com.apple.Terminal 
1

We can use an AppleScript to both retrieve and set the profile of the foremost Terminal window:

echo 'tell application "Terminal" to return name of current settings of first window' | osascript

We can similarly set the profile:

echo 'tell application "Terminal" to set current settings of first window to settings set "Basic"' | osascript

Replace "Basic" with the name of the profile you wish to adopt.

These commands will apply to the current/foremost tab or window of Terminal.app

I've also written a script that will get/set the profile depending on whether a profile name is provided: https://github.com/starbase527/dotfiles/blob/master/local/bin/term-profile . Example usage:

# Gets profile name
> term-profile
Basic
# Sets profile to Basic
> term-profile Basic
>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .