Mac turn dark mode on or off using terminal command

Toggle Dark mode on off using Mac Terminal Command
Toggle Dark mode on off using Mac Terminal Command

If you with to turn Dark Mode on/off on your Mac using macOS Terminal command you can do that using dark-mode package.

  1. Make sure you have brew installed - if not follow the tutorial to install it - link
  2. Install package dark-mode using command: brew install dark-mode
    % brew install dark-mode
    Running `brew update --preinstall`...
    ==> Auto-updated Homebrew!
    Updated Homebrew from 51da118a9 to 374adf7f1.
    Updated 2 taps (homebrew/core and homebrew/cask).
    Pouring dark-mode--3.0.2.arm64_monterey.bottle.tar.gz
    🍺  /opt/homebrew/Cellar/dark-mode/3.0.2: 5 files, 93KB
    ==> `brew cleanup` has not been run in the last 30 days, running now...
  3. To turn on Dark Mode type: dark-mode on in Terminal
  4. To turn off Dark Mode type: dark-mode off in Terminal

Note: When the first time you run the command using the dark-mode package you will be asked to provide access to System Events.

“Terminal“ wants access to control “System Events“. 
Allowing control will provide access to documents and data in “System Events“, 
and to perform actions within that app.


% dark-mode --help

    $ dark-mode [command]

    <none>  Toggle dark mode
    on      Enable dark mode
    off     Disable dark mode
    status  Dark mode status

  Created by Sindre Sorhus

Have Questions? Post them here!
Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.