Mac OSX boot-up configuration

Source: Internet
Author: User
Tags list of attributes root access

Login Items

After the current user of Mac OSX has successfully logged on, the startup item configuration file for that category is stored in ~/library/preferences/com.apple.loginitems.plist, so only the current user, you can set it in the following ways:

1. The settings under "Users and Groups" in System preferences can be deleted, added, turned on and off;

2. You can directly modify the ~/library/preferences/com.apple.loginitems.plist configuration file, where each startup item corresponds to a dictionary, with alias, Icon, name three values, Where name is the NSString type, the other is the data type, it is not known so serialized generation, so it can be deleted now;

3. Through the Lssharedfilelistinsertitemurl and Lssharedfilelistitemremove method to add the deletion, the relevant introduction (Registration program boot).

Launchd Daemon

This type of startup item is started by Launchd, and Launchd is the key process for initializing the system environment under Mac OS, which is the first process that starts in the OS environment after the kernel is loaded successfully. It is very simple to configure the self-launcher in this way, only one plist file is required, and the directory where the plist file exists is

~/library/launchagents

/library/launchagents

/system/library/launchagents

The above three directories are the recommended path for the system to be placed, which is the process that starts after login

~/library/launchdaemons

/library/launchdaemons

/system/library/launchdaemons

When placed in the above three directories, start the daemon as a process that starts immediately after the system starts

The permissions and priorities of different directory processes start differently, and you can set them in the following ways:

1. Add and remove specified startup items by Launchctl load xxx.plist or launchctl unload xxx.plist command;

2. Directly create, modify, delete the plist file under the relevant directory.

The main field in plist and its meaning

Label <required, nsstring= "" > a unique identifier used in launchd, similar to every program that has a identifies.

UserName <optional, string= "" > Specifies the user who is running the startup item, which applies only if Launchd is running as the root user.

GroupName <optional, string= "" > Specifies the group that runs the startup item, which applies only if Launchd is running as the root user.

KeepAlive <optional, boolean= "" > This key value is used to control whether the executable is running continuously, or to meet the specific conditions before starting. The default value is False, which means that the specific condition is met before it is started. When the value is set to Ture, it indicates that the executable file is unconditionally opened and kept within the entire system run cycle.

Runatload <optional, boolean= "" > Identity launchd the executable file specified by the path is started immediately after the service is loaded. The default value is False.

Program<optional, string= "" > This value is used to specify the path of the process's executable file.

Programarguments<optional,array of= "" strings= "> If you do not specify the program, you must specify the key, including the executable file and the running parameters.

3.StartupItems

Startupitems, as the name implies, is the program that runs during system startup, which can be a program that terminates immediately after running (for example, emptying the trash from the boot), or a background process that has been running for the duration of the system.

Startupitems are generally stored under the following two paths:

1)/system/library/startupitems

2)/library/startupitems

Most of the system-related startupitems are placed under the/system/library/startupitems path, and they are executed before the/library/startupitems path, Because Startupitems in the former path provides system-level basic services, such as crash Reporting,core graphics Services,system accounting, and the latter path does not exist by default, You need to create them manually.

Here we take the icebergcontroltower of the/library/startupitems directory as an example.

In a nutshell, on Mac OS X, a startupitems contains the following two things:

1) enforceable procedures;

2) contains a plist file (startupparameters.plist) that relies on process relationships.

Startupparameters.plist is a list of attributes that contains the necessary conditions for running an executable program, the main field in plist, and its meaning

The plist requires root access and contains several things:

1) Description;

A simple description of the service is simply a description, not a description of the actual process name.

2) provides;

Specifies the services provided by the Startupitems. As described in plist file provides, the Startupitems open background process is named: Iceberg Control Tower.

Provides can specify multiple services, reflected in the figure is item0,item1 ... such as There's only Item0 here.

3) Uses;

Specifies the services that need to be turned on before the Startupitems is loaded. The MAC OS x system first tries to load the service specified in uses and then loads the startupitems. That is, the system will still load startupitems even if the service specified in uses is not successfully loaded.

4) Orderpreference;

Specifies the chronological order in which Startupitems are executed. The importance of this order is after uses, which specifies the order after uses is executed. Possible values include: First, Early, None (default), late, last.

5) Messages.

The executable File

Note: 1) The name of the executable file is the same as the filename of the folder in which it resides, which is the default rule for the system.

2) root permission is required to operate the executable file.

3) The executable file is a shell script.

Open the Icebergcontroltower file directory under the same name executable file, you can see the specific contents of the script:

A generic executable file contains a few things:

1)./etc/rc.common

A script library provided by Apple that contains an interface that introduces parameters to an executable file. Here load this library is primarily called Runservice.

2) StartService (), StopService (), Restartservice ()

The corresponding function is executed when the executable file receives a parameter of Start,stop or restart.

Parameter meaning:

Start: Start the service during the boot process;

Stop: Stops the service during shutdown;

Restart: Restart the service under certain conditions.

3) Runservice "$"

Executes the service that is specified for the first parameter passed to the script.

"$" means the first parameter passed to the script. For example, if the parameter passed in is start, then StartService () is executed.

(Part of the content is referenced in http://blog.csdn.net/abby_sheen/article/details/7817198)

http://www.tanhao.me/talk/1287.html/

Mac OSX boot-up configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.