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
macOS RAM Disk Deep Dive: Is Memory Allocation Dynamic or Fixed?
Duration: 00:00 | DP | 2026-07-09 20:02:36Declutter Your Desktop: How to Change macOS Screenshot Save Location via Command Line
Duration: 00:00 | DP | 2026-07-10 08:05:12How to Fix "Permission denied" Error When Running Shell Scripts in Mac/Linux
Duration: 00:00 | DP | 2026-07-06 08:54:30Boost Mac Productivity: How to Set F1-F12 as Standard Function Keys on macOS
Duration: 00:00 | DP | 2026-07-12 08:15:37Bypassing macOS Restrictions: How to Set a 1-Digit Login Password
Duration: 00:00 | DP | 2026-07-13 08:20:49How to Fix Mac mini Not Receiving SMS Messages and iCloud Sync Stuck
Duration: 00:00 | DP | 2026-07-06 22:07:00Guide to Sharing Skill Libraries Across Multiple AI Agents Using Symlinks
Duration: 00:00 | DP | 2026-07-08 09:46:00How to Add an Email Alias to Your Hotmail or Outlook Account
Duration: 00:00 | DP | 2026-06-28 19:41:10Never Lose Output Again: How to Show Unlimited Scrollback History in macOS iTerm2
Duration: 00:00 | DP | 2026-07-21 21:05:04Ultimate Guide: How to Export Markdown Preview to PDF in VS Code
Duration: 00:00 | DP | 2026-07-23 09:12:53PhpStorm Shortcut Tips: How to Use Cmd+D to Select Next Occurrence Like Sublime Text
Duration: 00:00 | DP | 2026-07-28 09:38:55Cron Job Failing? The Ultimate Guide to Fixing 'docker: command not found'
Duration: 00:00 | DP | 2026-08-01 09:59:44Master 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:00Recommended
Decoding SEO's Canonical Tag: From Basics to Multilingual Site Mastery
00:00 | 124Confused by the <link rel="canonical"> tag? This a...
Bootstrap JS Deep Dive: `bootstrap.bundle.js` vs. `bootstrap.js` - Which One Should You Use?
00:00 | 178Ever been confused between `bootstrap.bundle.min.j...
Building a Bulletproof PHP Analytics System: From DB Schema to Self-Healing Cron Jobs
00:00 | 185This article provides a comprehensive walkthrough ...
Why Does My Device Have Three IPv6 Addresses? A Guide to Link-Local, Public, and Privacy Addresses
00:00 | 244Confused after enabling IPv6 and finding multiple ...