Tips & Advice
Danish Kapoor
Danish Kapoor

How to set automatic on and off using Terminal on Mac?

While Apple’s Mac Mini models are becoming more compact and aesthetic, some practical details direct users to different solutions. Mac Mini users may have difficulty accessing the power button. As a solution to this situation, Mac users are offered the option of adjusting the startup and shutdown schedule of their devices. However, with recent macOS updates, these processes have become more complex. It is now necessary to use the Terminal application to adjust the power timing settings.

With macOS Ventura, Apple replaced the System Preferences app with System Settings, and with this change, many user-friendly features were also removed. However, it is still possible to manually configure features such as power scheduling from the command line. In this guide, we will discuss in detail how you can adjust power timing settings via Terminal. However, it is worth noting that this process involves some risks for those who are inexperienced with Terminal commands.

How to schedule power on Mac?

There are a few important details that users who want to set the Mac’s startup and shutdown times should know. First of all, commands entered via Terminal support a single scheduling option. In other words, it is not possible to determine both the opening and closing times separately at the same time; The last entered command becomes valid. Therefore, you need to use a single command line to determine the opening and closing times.

Opening the terminal application and initial settings

To open the Terminal app, go to the Utilities folder in the Applications folder and find Terminal. Alternatively, you can easily find the app by typing “Terminal” into Spotlight search (⌘ + Space).

Once the terminal opens, you can start by entering this command to determine which days and at what times your Mac will turn on:

sudo pmset repeat poweron

This command allows your Mac to automatically turn on on a daily schedule. However, before completing the command, you need to determine which days and times you want to perform this operation.

Determining days and times

If you want the Mac to turn on automatically on which days, you need to add the letters representing these days to the script. The meanings of the letters are as follows:

  • Monday = M
  • Tuesday = T
  • Wednesday = W
  • Thursday = R
  • Friday = F
  • Saturday = S
  • Market = U

For example, if you want your Mac to turn on at 7:00 am every weekday, you can use the following command:

sudo pmset repeat poweron weekdays 7:00:00

This command will turn on the device at 7 am every weekday. If you want to select specific days, for example Wednesday through Sunday, you can type this command:

sudo pmset repeat poweron WRFSU 7:00:00

Your Mac will automatically turn on on the days and times you specify. At this stage, you can press Enter to complete the command. The terminal may ask you to enter your password; This password is the password you use to log in to your Mac.

Set closing time

After setting the opening time, you need to add the word “shutdown” to also set the closing time. For example, if you want your Mac to turn on at 7 a.m. Wednesday through Sunday and shut down at 1 a.m. every day, you can use the following command:

sudo pmset repeat poweron WRFSU 7:00:00 shutdown MTWRFSU 1:00:00

Thanks to this command, your device will turn on at 7 am from Wednesday to Sunday and turn off at 1 pm every day. After completing the program, you can end the process by pressing Enter.

Cleaning and checking the program

If you want to disable the automatic power on and off feature of the device after a certain period of time, you can type the following line to clear the command via Terminal:

sudo pmset repeat cancel

The above command removes all power schedules set on the device. You can also use the following command to check your program:

pmset -g sched

This command allows you to view the power timing settings you have specified and allows you to observe whether your program is running correctly.

What should you do when the shutdown does not occur?

In some cases, the device may not shut down due to open applications or unsaved work. In such a case, your device may remain in sleep mode instead of shutting down. If you want to determine the time to wake up from sleep mode, you can use the phrase “wakeorpoweron”. For example, when you want the device to turn off at 01:00 every day of the week and wake up at 07:00 on weekdays, you can use the following command:

sudo pmset repeat shutdown MTWRFSU 1:00:00 wakeorpoweron MTWRF 7:00:00

With this command, your Mac will wake up from sleep mode at the hours you specify and save energy.

What should you pay attention to when using the terminal?

An important point to consider when using the terminal is to enter the commands correctly. The terminal may produce undesirable results if incorrect command entries are made. Especially for inexperienced users, it is important to obtain information from reliable sources when writing commands via Terminal. If you want to learn more about pmset commands used in Terminal, you can access the help document by typing the “man pmset” command on Terminal. This will allow you to understand which commands perform which functions.

In addition, the application should not be made without making sure that the commands entered through the Terminal are correct. Otherwise, unexpected changes may occur in the system. Despite everything, Terminal stands out as a powerful tool, albeit a bit challenging, for those who want to use the power scheduling feature.

Danish Kapoor