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.

Source: https://github.com/sindresorhus/dark-mode

% dark-mode --help

  Usage
    $ dark-mode [command]

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

  Created by Sindre Sorhus

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap