I want to change X11 color settings from 'From Display'(default) to '256 colors' using Terminal.app. I already know how to change it using the GUI, but I need a bash script to do it. I have:

  • Mavericks 10.9.5
  • XQuartz 2.7.7 (xorg-server 1.15.2)
  • MacbookPro
  • 1
    Can you please share the versions of X11 and the macOS you are using? The model of computer would be nice too. Feb 24, 2017 at 6:15
  • 1
    Macos : 10.9.5 Mavericks and X11 : XQuartz 2.7.7 (xorg-server 1.15.2) and Hardware : MacbookPro 15" 2014
    – Aadu Thoma
    Feb 24, 2017 at 6:17
  • 1
    Would you be happy with a bash (or sh) script to do it that simply drives the GUI using osascript(1) to send events to AppleScript? Feb 24, 2017 at 6:22
  • 1
    I am already using a bash script file to make some other settings, i want to append that file with one or two lines to change the color settings. I don't want to use any ui for now, if no other way to achieve this i may consider using ui. Thanks @D A Vincent
    – Aadu Thoma
    Feb 24, 2017 at 7:10
  • 1
    What process did you use to install XQuartz 2.7.7? I'm sorry and a bit unhappy to ask. I've installed various flavours of X11 in the past, but I'm not sure how to do it on 10.9 Mavericks, and how that differs from the computers I have, which have newer versions of macOS. Feb 24, 2017 at 8:28

1 Answer 1


The command to change Color: From Display, as shown in X11 Preferences of XQuartz, to
Color: 256 Colors, from the command line in Terminal is:

defaults write org.macosforge.xquartz.X11 depth -int 8
  • Note: XQuartz should be closed when making this change or the ones below, from the command line or from within a bash script.

To reset it to the default, Color: From Display, use the following:

defaults delete org.macosforge.xquartz.X11 depth


defaults write org.macosforge.xquartz.X11 depth -int -1
  • Note: By default the depth key doesn't exist however, when reset from the GUI to the default, the setting is -1, although either is acceptable to set the default back to Color: From Display.
  • Thanks to User3439894 for solving my issue, its working from terminal now.Thanks Again.
    – Aadu Thoma
    Feb 27, 2017 at 0:46

You must log in to answer this question.

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