macOS Advanced Guide: How to Elegantly Set Programs to Run at Startup
Content
Whether it's to boost productivity or run automated background scripts, we often need certain programs to run automatically when macOS starts or logs in. During our daily development and operations at wiki.lib00.com, we have summarized the four most common methods to achieve this, covering needs from regular users to professional developers.
## 1. Manage via "System Settings" (Recommended for Regular Users)
This is the most standard and visual method, suitable for most applications with a Graphical User Interface (GUI):
1. Click the Apple icon in the top left corner -> **System Settings**.
2. Select **General** -> **Login Items**.
3. In the "Open at Login" list, click the **"+"** button and select your target program from the "Applications" folder.
---
## 2. Set via the Dock (The Fastest Way)
If your target program is currently running or already pinned to the Dock, this is the quickest way to set it up:
1. **Right-click** the program's icon on the Dock.
2. Select **Options**.
3. Check **Open at Login**.
---
## 3. Using LaunchAgents (For Professionals/Developers)
If you need finer control (e.g., running background scripts, headless programs, or configuring environment variables), you can use macOS's underlying `launchd` mechanism. This is particularly useful when setting up local development environments like those related to `lib00`.
1. Navigate to the current user's LaunchAgents directory: `~/Library/LaunchAgents/`.
2. Create a `.plist` configuration file (e.g., `com.lib00.autostart.plist`).
3. Write the configuration. Here is an example:
```xml
<?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>com.lib00.autostart</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/YourApp.app/Contents/MacOS/YourApp</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
```
4. Load the configuration using the `launchctl` command:
```bash
launchctl load ~/Library/LaunchAgents/com.lib00.autostart.plist
```
---
## 4. For Server-Level Services: LaunchDaemons
If you need the program to start **before the user logs in** (i.e., a system-level service, typically used in server environments or for underlying daemons):
* Place the configured `.plist` file in the `/Library/LaunchDaemons/` directory.
* These tasks will run with `root` privileges, so pay special attention to security and permission settings.
---
## 💡 Additional Note (macOS Ventura and later)
Starting with macOS Ventura, the system has tightened its management of background tasks. When you add a new startup item, the system will prompt "Allow in the Background" in the Login Items settings. Please ensure that the toggle for the relevant program is turned on; otherwise, the auto-start task (especially scripts in `LaunchAgents`) might be blocked by the system.
Related Contents
How to Fix "Permission denied" Error When Running Shell Scripts in Mac/Linux
Duration: 00:00 | DP | 2026-07-06 08:54:30How to Fix Mac mini Not Receiving SMS Messages and iCloud Sync Stuck
Duration: 00:00 | DP | 2026-07-06 22:07:00How to Add an Email Alias to Your Hotmail or Outlook Account
Duration: 00:00 | DP | 2026-06-28 19:41:10Master Sublime Text Code Folding: The Ultimate Shortcut Guide to Unfold/Fold Blocks Instantly
Duration: 00:00 | DP | 2026-01-07 08:06:27NVM/Node Command Not Found in New macOS Terminals? A Two-Step Permanent Fix!
Duration: 00:00 | DP | 2025-12-04 09:35:00One-Command Website Stability Check: The Ultimate Curl Latency Test Script for Zsh
Duration: 00:00 | DP | 2025-12-07 23:25:50How Can a Docker Container Access the Mac Host? The Ultimate Guide to Connecting to Nginx
Duration: 00:00 | DP | 2025-12-08 23:57:30Show Hidden Files on Mac: The Ultimate Guide (2 Easy Methods)
Duration: 00:00 | DP | 2025-12-12 01:32:30Boost Your VS Code Productivity: Select All Occurrences in a Single Keystroke!
Duration: 00:00 | DP | 2026-06-27 14:25:00Decoding `realpath: command not found` and Its Chained Errors on macOS
Duration: 00:00 | DP | 2025-11-19 12:45:02Unlock Your Mac: The Ultimate Guide to Showing and Hiding Hidden Files in Finder
Duration: 00:00 | DP | 2025-11-19 21:16:36macOS Hosts File Doesn't Support Wildcards? Here's the Ultimate Fix with Dnsmasq!
Duration: 00:00 | DP | 2025-11-20 05:48:10Why Are My Mac Files Duplicated on NFS Shares? The Mystery of '._' Files Solved with PHP
Duration: 00:00 | DP | 2025-12-18 16:58:20Say Goodbye to Clutter: Master Sublime Text Code Folding with These Essential Shortcuts
Duration: 00:00 | DP | 2025-11-24 03:35:20The Ultimate Docker & Xdebug Guide: Solving the 'Address Already in Use' Error for Port 9003 with PhpStorm
Duration: 00:00 | DP | 2026-02-18 14:50:37Recommended
How Do You Pronounce Nginx? The Official Guide to Saying It Right: 'engine x'
00:00 | 159Struggling with the correct pronunciation of Nginx...
Why Does My Device Have Three IPv6 Addresses? A Guide to Link-Local, Public, and Privacy Addresses
00:00 | 109Confused after enabling IPv6 and finding multiple ...
How to Fix the "tsx: not found" Error During Vue Vite Builds in Docker
00:00 | 114Encountering the `sh: 1: tsx: not found` error whe...
Why Encode Hashes with Base64/Base16 After MD5? A Deep Dive into Hashing vs. Encoding
00:00 | 163Many developers are familiar with hashing algorith...