Turn on dark mode at a certain time After upgrading to macOS Mojave, I was wondering if there is a setting which would automatically turn on Dark Mode at a certain time of day?

I only found the setting to turn it on and off manually.
In case someone is interested in an answer that doesn't require you to install anything but does require you to touch code just a little... Here you go....

How to toggle dark mode with Applescript:

tell application "System Events"
    tell appearance preferences
        set dark mode to not dark mode
    end tell
end tell


How to turn ON dark mode with Applescript:

tell application "System Events"
    tell appearance preferences
        set dark mode to true
    end tell
end tell


How to turn OFF dark mode with Applescript:

tell application "System Events"
    tell appearance preferences
        set dark mode to false
    end tell
end tell




There are pretty robust applications out there that can run scripts or actions at a specific time, but these applications are mostly fairly extensive and expensive. I did want to mention one because it allows you to do more than just toggle the dark mode: Keyboard Maestro - It's sort of like Automator, but better. Don't let the outdated look fool you.

I would use  launchd, because it doesn't require you to install anything. It does require you to touch a little bit of code, but nothing major.

How to trigger Applescript at a specific time with Launchd property list file (plist):


You need to make a new .plist file in ~/Library/LaunchAgents (~ represents your user folder) 


If you want to make it run for all users, put it in /Library/LaunchAgents (Macintosh HD). 
This .plist is just a text file that you can edit in any text editor and save as text with the extensions .plist. 
You likely have existing files in those folders that you can duplicate to create your own. If you open an existing .plist file with TextEdit.app, you won't accidentally save it as a .rtf file or something.

Copy &amp; paste this in the .plist file:




&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
  &lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;com.time.trigger.darkmode&lt;/string&gt;
    &lt;key&gt;Program&lt;/key&gt;
    &lt;string&gt;/usr/bin/osascript&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
      &lt;string&gt;osascript&lt;/string&gt;
      &lt;string&gt;/Users/joonaspaakko/Desktop/toggle-darkmode.scpt&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;StartCalendarInterval&lt;/key&gt;
    &lt;array&gt;
      &lt;dict&gt;
        &lt;key&gt;Hour&lt;/key&gt;
        &lt;integer&gt;21&lt;/integer&gt;
        &lt;key&gt;Minute&lt;/key&gt;
        &lt;integer&gt;20&lt;/integer&gt;
      &lt;/dict&gt;
    &lt;/array&gt;
  &lt;/dict&gt;
&lt;/plist&gt;



The line below &lt;string&gt;osascript&lt;/string&gt; points to the Applescript .scpt file that should be triggered. You will change this in step 3 after creating a script file.
The array below &lt;key&gt;StartCalendarInterval&lt;/key&gt; that says Hour and Minute is where you set the time. Current set time is H 21 M 20 = 9:20pm


These steps are maybe a little backwards since I already have the script location set in the .plist but let's create the .scpt file next.


Run Script Editor application /Applications/Utilities/Script Editor.app.


Paste in whichever Applescript you wish to use (At the top of the answer in case you forgot)
You can test run the Applescripts in this application by pressing the play button.
Save as Script file. If you're just using the script yourself, save it somewhere under your home directory. If you're setting this up for all accounts you'll need to store it in a location everyone can access, such as /Library/Scripts.
Return to your .plist file from step 2, and change the line below &lt;string&gt;osascript&lt;/string&gt; to point at your new Applescript (.scpt file).

When both files are created, an important step is to log out (or restart) because these launch agents start running in the background on launch. 


If you want to stop it from running, you can move the .plist from the folder or just delete it.