Mac Library Launchagents
Apr 17, 2012 Monitor OS X LaunchAgents folders to help prevent malware attacks. While malware scanners can detect threats once definitions for them are available, you can monitor or lock your systems' launch. 2014-8-16 /Library/LaunchDaemons 用户登陆前运行 plist(程序) LaunchAgents /Library/LaunchAgents 用户登录后运行相应的 plist(程序) LaunchDaemons Vs LaunchAgents 的区别 这两种开机启动的分水岭如下图所示 Reference Homebrew, Mac OS X 最强大的包. The previous section has introduced the shortest but incomplete way to erase Skype on Mac. In order to eliminate the supporting items and related processes, the user should be familiar with how to work with the Library folder. To see the user library, hold down the option key while using the Finder 'Go To Folder' command. Enter /Library/LaunchAgents. If you prefer to make your user library permanently visible, use the Terminal command found below. May 15, 2016 /Library/LaunchAgents – com.pcv.hlpramc.plist; com.PCvark.Advanced-Mac-Cleaner.plist After you finish deleting, make sure that you empty Trash. This should be enough to remove Advanced Mac Cleaner from your PC.
- Launchd
- Osx Launchagents
- Mac Library Launchagents City
- Mac Library Launchagents Download
- Mac Library Launch Agents 2017
- Mac Library Launch Agents Near Me
- 2019-11-25 The problem was obviously connected to the directory /Library/LaunchAgents and not the plist files itself. The solution was to reset the file permissions. Chmod 700 /Library/LaunchAgents. Update for homebrew users: (2015-02-23) Yesterday I just found LaunchRocket which is a Mac PreferencePane for managing services with launchd. It is homebrew.
- 2019-7-7 晚上在 terminal 里敲代码,发现系统异常的卡顿。在 Activity Monitor 里发现 ReportCrash 进程占用了大量的 CPU 不断发送崩溃报告说明不断有进程在崩溃,先看一下系统日志 $ tail -F /var/log/system.log Feb 5 21:09:01 Sun-Zhongweis-MacBook-Pro.
What are startup items?
Startup items, or login items, are services and applications that launch every time you start your Mac. These are applications that sneak into startup items without notice, never asking if you need or want them there. This way you may end up with a dozen apps launching as soon as you turn on your Mac, weighing heavily on its processor and memory capacities and slowing it down. Such items can increase your Mac’s startup time and decrease its performance.
Plus, sometimes when you remove an application or a service, it leaves a login item with a broken link. These broken login items are completely useless, cause unwanted messages, and waste your Mac's resources (because they look for non-existent applications). Whether you're running macOS Catalina or El Capitan, or earlier — it's all the same, so just read on.
So, let's go over how to take control of login items, and how to get rid of unwanted, broken or hidden startup items.
How to disable startup programs?
Do you want to stop programs from running at startup? There’s an easy way to remove programs from startup and get your Mac to load faster on launch. The fastest way to turn off startup items on Mac is an app like CleanMyMac X.
- Download CleanMyMac for free.
- Launch the app.
- Open Optimization tab.
- Click on Login items.
- From the list of apps, disable the ones you don’t need on startup.
- Done!
How to change startup programs manually?
Disabling Mac startup programs is possible manually. Therefore, if you have some time and would like to do it yourself, follow the steps below.
Your login items are listed in settings. One of the easiest ways to control startup items is inside System Preferences > Users & Groups.
- Open System Preferences.
- Go to Users & Groups.
- Choose your nickname on the left.
- Choose Login items tab.
- Check startup programs you want to remove.
- Press the “–” sign below.
- You’re done.
- If you need to add an item back, press “+” and choose the app you’d like add.
- Then restart your Mac to see the changes.
How to fix broken startup items?
Broken Mac startup files are left there because some part of apps are left on your Mac long after you’ve moved the app to the Trash. To get rid of these parts and to fix your startup, you’re going to need CleanMyMac again. First, you need to check if they’re among startup items and disable them if so. You can do it following the instructions above. Then you need to remove app leftovers. CleanMyMac works fine on macOS High Sierra and earlier OS.
- Launch CleanMyMac.
- Choose Uninstaller tab.
- Scroll through the list of apps.
- If you spot any app that you’ve deleted, check them.
- Delete the app leftovers you’ve chosen.
You can also find and remove broken login items with the help of System Junk module:
- Choose System Junk tab.
- Click Scan.
- Review details and click Clean.
Finally, you need to clean your macOS startup items through launch services:
- Open Maintenance tab.
- Choose Rebuild Launch Services.
- Hit Run.
- Done.
Once you do it, all broken app data on your Mac will be fixed.
Remove daemons and agents from startup process
If speaking of files, first go to the system folder /Library/StartUpItems. Here you’ll find all the startup files that are being launched with the system. You can delete the login item you think is necessary if you’re totally sure what you are doing.
Also, the /Library/LaunchDaemons folder contains a bunch of preference files that define how the application that is being launched along with the system should work. You might want to delete some of these files as well if you know you don’t need them and removing them is safe.
The /Library/LaunchAgents contains preference files responsible for the apps that launch during the login process (not the startup).
The above-mentioned folders contain app-related files. However, you can also check system folders to review whether you need some of the system applications to be running on startup:
- /System/Library/LaunchDaemons - note that besides preference files this folder contains other important system items that are recommended to keep untouched.
- /System/Library/LaunchAgents - most probably, you won’t also find anything worth removing in this folder, however, keeping this location in mind might help you find files related to a problematic app that causes troubles on Mac startup. If you have a problematic application that messes about on login, you can try to trace it back from this folder.
But, if you’re looking for simple ways to remove login items, we suggest using a professional Mac utility. Download CleanMyMac X for free and make unwanted and broken login items a thing of the past.
Cd library preferences. I want the put the following plist in my Managed Preferences folder:/Library/Managed Preferences/accountname/com.google.Chrome.plistwith the following content:
Key
Description
Label
Contains a unique string that identifies your daemon to launchd
. (required)
ProgramArguments
Contains the arguments used to launch your daemon. (required)
inetdCompatibility
Indicates that your daemon requires a separate instance per incoming connection. This causes launchd
to behave like inetd
, passing each daemon a single socket that is already connected to the incoming client. (required if your daemon was designed to be launched by inetd
; otherwise, must not be included)
KeepAlive
This key specifies whether your daemon launches on-demand or must always be running. It is recommended that you design your daemon to be launched on-demand.
For more information: For a complete listing of the keys, see the launchd.plist
manual page.
For sample configuration property lists, look at the files in /System/Library/LaunchDaemons/
. These files are used to configure many daemons that run on OS X.
Writing a “Hello World!” launchd Job
The following simple example launches a daemon named hello
, passing world
as a single argument, and instructs launchd to keep the job running:
In this example, there are three keys in the top level dictionary. The first is Label
, which uniquely identifies the job. when. The second is ProgramArguments
which has a value of an array of strings which represent the tokenized arguments and the program to run. The third and final key is KeepAlive
which indicates that this job needs to be running at all times, rather than the default launch-on-demand behavior, so launchd should always try to keep this job running.
Listening on Sockets
You can also include other keys in your configuration property list file. For example, if your daemon monitors a well-known port (one of the ports listed in /etc/services
), add a Sockets
entry as follows:
The string for SockServiceName
typically comes from the leftmost column in /etc/services
. The SockType
is one of dgram
(UDP) or stream
(TCP/IP). If you need to pass a port number that is not listed in the well-known ports list, the format is the same, except the string contains a number instead of a name. For example:
Debugging launchd Jobs
There are some options that are useful for debugging your launchd job.
The following example enables core dumps, sets standard out and error to go to a log file, and instructs launchd to temporarily increase the debug level of its logging while acting on behalf of your job (remember to adjust your syslog.conf accordingly):
Running a Job Periodically
The following example creates a job that is run every five minutes (300 seconds):
Alternately, you can specify a calendar-based interval. The following example starts the job on the 7th day of every month at 13:45 (1:45 pm). Like the Unix cron subsystem, any missing key of the StartCalendarInterval
dictionary is treated as a wildcard—in this case, the month is omitted, so the job is run every month.
Monitoring a Directory
The following example starts the job whenever any of the paths being watched have changed:
An additional file system trigger is the notion of a queue directory. The launchd daemon starts your job whenever the given directories are non-empty, and it keeps your job running as long as those directories are not empty:
Emulating inetd
The launchd daemon emulates the older inetd
-style daemon semantics if you provide the inetdCompatibility
key:
Behavior for Processes Managed by launchd
Processes that are managed by launchd
must follow certain requirements so that they interact properly with launchd
. This includes launch daemons and launch agents.
Required Behaviors
To support launchd
, you must obey the following guidelines when writing your daemon code:
You must provide a property list with some basic launch-on-demand criteria for your daemon. See Creating a launchd Property List File.
You must not daemonize your process. This includes calling the
daemon
function, callingfork
followed byexec
, or callingfork
followed byexit
. If you do,launchd
thinks your process has died. Depending on your property list key settings,launchd
will either keep trying to relaunch your process until it gives up (with a “respawning too fast” error message) or will be unable to restart it if it really does die.Daemons and agents that are installed globally must be owned by the root user. Agents installed for the current user must be owned by that user. All daemons and agents must not be group writable or world writable. (That is, they must have file mode set to
600
or400
.)We show you how to merge multiple photo libraries into a single library on your Mac. Your source for expert tips, special deals, commentary, reviews, and the latest tech news. How to Combine Multiple Photos Libraries Into a Single Library. So I decided the best thing to do would be to merge the two libraries into one on my Mac. Mar 18, 2020 If you're sure that you've exported all of the photos and videos that you want to keep from the source library, you can delete it to save disk space on your Mac. First, open the Finder and find the source library that you want to delete. By default, photo libraries are stored in your Pictures folder.
Recommended Behaviors
To support launchd
, it is recommended that you obey the following guidelines when writing your daemon code:
Wait until your daemon is fully initialized before attempting to process requests. Your daemon should always provide a reasonable response (rather than an error) when processing requests.
Register the sockets and file descriptors used by your daemon in your
launchd
configuration property list file.If your daemon advertises a socket, check in with
launchd
as part of your daemon initialization. For an example implementation of the check-in process, see SampleD.During check-in, get the launch dictionary from
launchd
, extract and store its contents, and then discard the dictionary. Accessing the data structure used for the dictionary is very slow, so storing the whole dictionary locally and accessing it frequently could hurt performance.Provide a handler to catch the
SIGTERM
signal.
Launchd
In addition to the preceding list, the following is a list of things it is recommended you avoid in your code:
Do not set the user or group ID for your daemon. Include the
UserName
,UID
,GroupName
, orGID
keys in your daemon’s configuration property list instead.Do not set the working directory. Include the
WorkingDirectory
key in your daemon’s configuration property list instead.Do not call
chroot
to change the root directory. Include theRootDirectory
key in your daemon’s configuration property list instead.Do not call
setsid
to create a new session.Do not close any stray file descriptors.
Do not change
stdio
to point to/dev/null
. Include theStandardOutPath
orStandardErrorPath
keys in your daemon’s configuration property list file instead.Do not set up resource limits with
setrusage
.Do not set the daemon priority with
setpriority
Although many of the preceding behaviors may be standard tasks for daemons to perform, they are not recommended when running under launchd
. The reason is that launchd
configures the operating environment for the daemons that it manages. Changing this environment could interfere with the normal operation of your daemon.
Deciding When to Shut Down
If you do not expect your daemon to handle many requests, you might want to shut it down after a predetermined amount of idle time, rather than continue running. Although a well-written daemon does not consume any CPU resources when idle, it still consumes memory and could be paged out during periods of intense memory use.
The timing of when to shut down is different for each daemon and depends on several factors, including:
The number and frequency of requests it receives
The time it takes to launch the daemon
The time it takes to shut down the daemon
The need to retain state information
If your daemon does not receive frequent requests and can be launched and shut down quickly, you might prefer to shut it down rather than wait for it to be paged out to disk. Paging memory to disk, and subsequently reading it back, incurs two disk operations. If you do not need the data stored in memory, your daemon can shut down and avoid the step of writing memory to disk.
Special Dependencies
While launchd
takes care of dependencies between daemons, in some cases, your daemon may depend on other system functionality that cannot be addressed in this manner. This section describes many of these special cases and how to handle them.
Osx Launchagents
Network Availability
If your daemon depends on the network being available, this cannot be handled with dependencies because network interfaces can come and go at any time in OS X. To solve this problem, you should use the network reachability functionality or the dynamic store functionality in the System Configuration framework. This is documented in System Configuration Programming Guidelines and System Configuration Framework Reference. For more information about network reachability, see Determining Reachability and Getting Connected in System Configuration Programming Guidelines.
Disk or Server Availability
If your daemon depends on the availability of a mounted volume (whether local or remote), you can determine the status of that volume using the Disk Arbitration framework. This is documented in Disk Arbitration Framework Reference.
Non-launchd Daemons
If your daemon has a dependency on a non-launchd
daemon, you must take additional care to ensure that your daemon works correctly if that non-launchd
daemon has not started when your daemon is started. The best way to do this is to include a loop at start time that checks to see if the non-launchd
daemon is running, and if not, sleeps for several seconds before checking again.
Be sure to set up handlers for SIGTERM
prior to this loop to ensure that you are able to properly shut down if the daemon you rely on never becomes available.
User Logins
In general, a daemon should not care whether a user is logged in, and user agents should be used to provide per-user functionality. However, in some cases, this may be useful.
To determine what user is logged in at the console, you can use the System Configuration framework, as described in Technical Q&A QA1133.
Kernel Extensions
If your daemon requires that a certain kernel extension be loaded prior to executing, you have two options: load it yourself, or wait for it to be loaded.
The daemon may manually request that an extension be loaded. To do this, run kextload
with the appropriate arguments using exec
or variants thereof. I/O Kit kernel extensions should not be loaded with kextload
; the I/O Kit will load them automatically when they are needed.
Note: The kextload
executable must be run as root in order to load extensions into the kernel. For security reasons, it is not a setuid executable. This means that your daemon must either be running as the root user or must include a helper binary that is setuid root in order to use kextload
to load a kernel extension.
Alternatively, our daemon may wait for a kernel service to be available. To do this, you should first register for service change notification. This is further documented in I/O Kit Framework Reference.
After registering for these notifications, you should check to see if the service is already available. By doing this after registering for notifications, you avoid waiting forever if the service becomes available between checking for availability and registering for the notification.
Note: In order for your kernel extension to be detected in a useful way, it must publish a node in the I/O registry to advertise the availability of its service. For I/O Kit drivers, this is usually handled by the I/O Kit family.
For other kernel extensions, you must explicitly register the service by publishing a nub, which must be an instance of IOService
.
For more information about I/O Kit services and matching, see IOKit Fundamentals, I/O Kit Framework Reference (user space reference), and Kernel Framework Reference (kernel space reference).
For More Information
The manual pages for launchd
and launchd.plist
are the two best sources for information about launchd
.
Mac Library Launchagents City
In addition, you can find a source daemon accompanying the launchd
source code (available from http://www.macosforge.org/). This daemon is also provided from the Mac Developer Library as the SampleD sample code project.
The Daemons and Agents technical note provides additional information about how launchd
daemons and agents work under the hood.
Mac Library Launchagents Download
Finally, many Apple-provided daemons support launchd
. Their property list files can be found in /System/Library/LaunchDaemons
. Some of these daemons are also available as open source from http://www.opensource.apple.com/ or http://www.macosforge.org/.
Mac Library Launch Agents 2017
Mac Library Launch Agents Near Me
Copyright © 2003, 2016 Apple Inc. All Rights Reserved. Terms of Use Privacy Policy Updated: 2016-09-13