Always use dark mode, on Mojave

dark modemojavepreferences

I have chosen Dark mode, under System Preferences > General > Appearance. Yet, it seems whenever starting up the computer, it switches back to Light.

I am guessing there is some "switch theme based on time of day" setting but I can't find it.

How can I have Dark mode permanently? Is there a workaround at least?

(To be really clear, the options are just Light and Dark, there is no Auto)

Mojave 10.14.2, mid 2014 MacBook Pro

Best Answer

Create a script to enable dark mode

This shell file will run an AppleScript command to enable Dark Mode. The first time this script is run, it may require permission to modify your system settings.

It is critical to mark the file executable with chmod +x - otherwise, it will not run and you will get a vague 'Load Failed: 5: Input/output error' from the launchctl service.

echo "osascript -e 'tell application \"System Events\" to tell appearance preferences to set dark mode to true'" > ~/AlwaysDarkMode.sh
chmod +x ~/AlwaysDarkMode.sh

Create a launch agent

Create a new text file in ~/Library/LaunchAgents titled AlwaysDarkMode.plist (or something else, if you'd like). Paste in the following contents, ensuring to change the username to your own. You cannot use relative paths like ~/AlwaysDarkMode.sh - you must write out the full path to the file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>AlwaysDarkMode.sh</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/YourUsername/AlwaysDarkMode.sh</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

Test the launch agent

Because the plist is stored in ~/Library/LaunchAgents, it should run automatically when logging in. However, it might request permissions the first time it runs, so you can load it manually with launchctl load ~/Library/LaunchAgents/AlwaysDarkMode.plist.