neulab/tldr huggingface dataset:
salt.modules.mac_keychain.install(cert, password, keychain='/Library/Keychains/System.keychain', allow_any=False, keychain_password=None) Install a certificate
password The password for the certificate being installed formatted in the way described for openssl command in the PASS PHRASE ARGUMENTS section.
Note: The password given here will show up as plaintext in the job returned info.
keychain The keychain to install the certificate to, this defaults to /Library/Keychains/System.keychain
allow_any Allow any application to access the imported certificate without warning
keychain_password If your keychain is likely to be locked pass the password and it will be unlocked before running the import
salt '*' keychain.install test.p12 test123
salt.modules.mac_keychain.list_certs(keychain='/Library/Keychains/System.keychain') List all of the installed certificates
salt '*' keychain.list_certs
salt.modules.mac_keychain.set_default_keychain(keychain, domain='user', user=None) Set the default keychain
keychain The location of the keychain to set as default
user   The user to set the default keychain as
salt '*' keychain.set_keychain /Users/fred/Library/Keychains/login.keychain
salt.modules.mac_keychain.uninstall(cert_name, keychain='/Library/Keychains/System.keychain', keychain_password=None) Uninstall a certificate from a keychain
cert_name The name of the certificate to remove
salt.modules.mac_keychain.unlock_keychain(keychain, password) Unlock the given keychain with the password
keychain The keychain to unlock
password The password to use to unlock the keychain.
salt '*' keychain.unlock_keychain /tmp/test.p12 test123
salt.modules.mac_pkgutil Installer support for macOS.
Installer is the native .pkg/.mpkg package manager for macOS.
salt.modules.mac_pkgutil.forget(package_id) New in version 2016.3.0.
Remove the receipt data about the specified package. Does not remove files.
WARNING: DO NOT use this command to fix broken package design
Parameters package_id (str) -- The name of the package to forget
Returns True if successful, otherwise False
salt '*' pkgutil.forget com.apple.pkg.gcc4.2Leo
salt.modules.mac_pkgutil.install(source, package_id) Install a .pkg from an URI or an absolute path.
• source (str) -- The path to a package.
• package_id (str) -- The package ID
salt '*' pkgutil.install source=/vagrant/build_essentials.pkg package_id=com.apple.pkg.gcc4.2Leo
salt.modules.mac_pkgutil.is_installed(package_id) Returns whether a given package id is installed.
Returns True if installed, otherwise False
salt '*' pkgutil.is_installed com.apple.pkg.gcc4.2Leo
salt.modules.mac_pkgutil.list_() List the installed packages.
Returns A list of installed packages
salt '*' pkgutil.list
salt.modules.mac_portspkg Support for MacPorts under macOS.
This module has some caveats.
1. Updating the database of available ports is quite resource-intensive. However, refresh=True is the default for all operations that need an up-to-date copy of available ports.  Consider refresh=False when you are sure no db update is needed.
2. In some cases MacPorts doesn't always realize when another copy of itself is running and will gleefully tromp all over the available ports database.  This makes MacPorts behave in undefined ways until a fresh complete copy is retrieved.
Because of 1 and 2 it is possible to get the salt-minion into a state where salt mac-machine pkg./something/ won't want to return.  Use
salt-run jobs.active
on the master to check for potentially long-running calls to port.
Finally, ports database updates are always handled with port selfupdate as opposed to port sync.  This makes sense in the MacPorts user community but may confuse experienced Linux admins as Linux package managers don't upgrade the packaging software when doing a package database update.  In other words salt mac-machine pkg.refresh_db is more like apt-get update; apt-get upgrade dpkg apt-get than simply apt-get update.
salt.modules.mac_portspkg.available_version(*names, **kwargs) This function is an alias of latest_version. Return the latest version of the named package available for upgrade or installation
refresh Update ports with port selfupdate
salt.modules.mac_portspkg.install(name=None, refresh=False, pkgs=None, **kwargs) Install the passed package(s) with port install
version Specify a version to pkg to install. Ignored if pkgs is specified.
salt '*' pkg.install <package name> salt '*' pkg.install git-core version='1.8.5.5'
variant Specify a variant to pkg to install. Ignored if pkgs is specified.
salt '*' pkg.install <package name> salt '*' pkg.install git-core version='1.8.5.5' variant='+credential_osxkeychain+doc+pcre'
salt '*' pkg.install pkgs='["foo","bar"]' salt '*' pkg.install pkgs='["foo@1.2","bar"]' salt '*' pkg.install pkgs='["foo@1.2+ssl","bar@2.3"]'
salt.modules.mac_portspkg.latest_version(*names, **kwargs) Return the latest version of the named package available for upgrade or installation
salt.modules.mac_portspkg.list_pkgs(versions_as_list=False, **kwargs) List the packages currently installed in a dict:
salt.modules.mac_portspkg.list_upgrades(refresh=True, **kwargs) Check whether or not an upgrade is available for all packages
salt.modules.mac_portspkg.refresh_db(**kwargs) Update ports with port selfupdate
salt mac pkg.refresh_db
salt.modules.mac_portspkg.remove(name=None, pkgs=None, **kwargs) Removes packages with port uninstall.
salt.modules.mac_portspkg.upgrade(refresh=True, **kwargs) Run a full upgrade using MacPorts 'port upgrade outdated'
salt.modules.mac_portspkg.upgrade_available(pkg, refresh=True, **kwargs) Check whether or not an upgrade is available for a given package
salt.modules.mac_portspkg.version(*names, **kwargs) Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned.
salt.modules.mac_power Module for editing power settings on macOS New in version 2016.3.0.
salt.modules.mac_power.get_computer_sleep() Display the amount of idle time until the computer sleeps.
Returns A string representing the sleep settings for the computer
salt '*' power.get_computer_sleep
salt.modules.mac_power.get_display_sleep() Display the amount of idle time until the display sleeps.
Returns A string representing the sleep settings for the displey
salt '*' power.get_display_sleep
salt.modules.mac_power.get_harddisk_sleep() Display the amount of idle time until the hard disk sleeps.
Returns A string representing the sleep settings for the hard disk
salt '*' power.get_harddisk_sleep
salt.modules.mac_power.get_restart_freeze() Displays whether 'restart on freeze' is on or off if supported
Returns A string value representing the "restart on freeze" settings
salt '*' power.get_restart_freeze
salt.modules.mac_power.get_restart_power_failure() Displays whether 'restart on power failure' is on or off if supported
Returns A string value representing the "restart on power failure" settings
salt '*' power.get_restart_power_failure
salt.modules.mac_power.get_sleep() Displays the amount of idle time until the machine sleeps. Settings for Computer, Display, and Hard Disk are displayed.
Returns A dictionary containing the sleep status for Computer, Display, and Hard Disk
salt '*' power.get_sleep
salt.modules.mac_power.get_sleep_on_power_button() Displays whether 'allow power button to sleep computer' is on or off if supported
Returns A string value representing the "allow power button to sleep computer" settings
salt '*' power.get_sleep_on_power_button
salt.modules.mac_power.get_wake_on_modem() Displays whether 'wake on modem' is on or off if supported
Returns A string value representing the "wake on modem" settings
salt '*' power.get_wake_on_modem
salt.modules.mac_power.get_wake_on_network() Displays whether 'wake on network' is on or off if supported
Returns A string value representing the "wake on network" settings
salt '*' power.get_wake_on_network
salt.modules.mac_power.set_computer_sleep(minutes) Set the amount of idle time until the computer sleeps. Pass "Never" of "Off" to never sleep.
Parameters minutes -- Can be an integer between 1 and 180 or "Never" or "Off"
Ptype  int, str
Returns True if successful, False if not
salt '*' power.set_computer_sleep 120 salt '*' power.set_computer_sleep off
salt.modules.mac_power.set_display_sleep(minutes) Set the amount of idle time until the display sleeps. Pass "Never" of "Off" to never sleep.
salt '*' power.set_display_sleep 120 salt '*' power.set_display_sleep off
salt.modules.mac_power.set_harddisk_sleep(minutes) Set the amount of idle time until the harddisk sleeps. Pass "Never" of "Off" to never sleep.
salt '*' power.set_harddisk_sleep 120 salt '*' power.set_harddisk_sleep off
salt.modules.mac_power.set_restart_freeze(enabled) Specifies whether the server restarts automatically after a system freeze.  This setting doesn't seem to be editable. The command completes successfully but the setting isn't actually updated. This is probably a macOS. The functions remains in case they ever fix the bug.
Parameters enabled (bool) -- True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively
salt '*' power.set_restart_freeze True
salt.modules.mac_power.set_restart_power_failure(enabled) Set whether or not the computer will automatically restart after a power failure.
salt '*' power.set_restart_power_failure True
salt.modules.mac_power.set_sleep(minutes) Sets the amount of idle time until the machine sleeps. Sets the same value for Computer, Display, and Hard Disk. Pass "Never" or "Off" for computers that should never sleep.
salt '*' power.set_sleep 120 salt '*' power.set_sleep never
salt.modules.mac_power.set_sleep_on_power_button(enabled) Set whether or not the power button can sleep the computer.
salt '*' power.set_sleep_on_power_button True
salt.modules.mac_power.set_wake_on_modem(enabled) Set whether or not the computer will wake from sleep when modem activity is detected.
salt '*' power.set_wake_on_modem True
salt.modules.mac_power.set_wake_on_network(enabled) Set whether or not the computer will wake from sleep when network activity is detected.
salt '*' power.set_wake_on_network True
salt.modules.mac_service The service module for macOS
This module has support for services in the following locations.
/System/Library/LaunchDaemons/ /System/Library/LaunchAgents/ /Library/LaunchDaemons/ /Library/LaunchAgents/
# As of version "2019.2.0" support for user-specific services were added. /Users/foo/Library/LaunchAgents/
NOTE: As of the 2019.2.0 release, if a service is located in a LaunchAgent path and a runas user is NOT specified, the current console user will be used to properly interact with the service.
NOTE: As of the 3002 release, if a service name of salt-minion is passed this module will convert it over to it's macOS equivalent name, in this case to com.saltstack.salt.minion. This is true for salt-master salt-api, and salt-syndic as well.
salt.modules.mac_service.available(name) Check that the given service is available.
Parameters name (str) -- The name of the service
Returns True if the service is available, otherwise False
salt.modules.mac_service.disable(name, runas=None) Disable a launchd service. Raises an error if the service fails to be disabled
• name (str) -- Service label, file name, or full path
Returns True if successful or if the service is already disabled
salt '*' service.disable org.cups.cupsd
salt.modules.mac_service.disabled(name, runas=None, domain='system') Check if the specified service is not enabled. This is the opposite of service.enabled
• name (str) -- The name to look up
• domain (str) -- domain to check for disabled services. Default is system.
Returns True if the specified service is NOT enabled, otherwise False
salt '*' service.disabled org.cups.cupsd
salt.modules.mac_service.enable(name, runas=None) Enable a launchd service. Raises an error if the service fails to be enabled
Returns True if successful or if the service is already enabled
salt '*' service.enable org.cups.cupsd
salt.modules.mac_service.enabled(name, runas=None) Check if the specified service is enabled (not disabled, capable of being loaded/bootstrapped).
NOTE: Previously this function would see if the service is loaded via launchctl list to determine if the service is enabled. This was not an accurate way to do so. The new behavior checks to make sure its not disabled to determine the status. Please use service.loaded for the previous behavior.
• name (str) -- The name of the service to look up.
• runas (str) -- User to run launchctl commands.
Returns True if the specified service enabled, otherwise False
salt '*' service.enabled org.cups.cupsd
salt.modules.mac_service.get_all(runas=None) Return a list of services that are enabled or available. Can be used to find the name of a service.
Parameters runas (str) -- User to run launchctl commands
Returns A list of all the services available or enabled
salt.modules.mac_service.get_enabled(runas=None) Return a list of all services that are enabled. Can be used to find the name of a service.
Returns A list of all the services enabled on the system
salt.modules.mac_service.launchctl(sub_cmd, *args, **kwargs) Run a launchctl command and raise an error if it fails
• sub_cmd (str) -- Sub command supplied to launchctl
• args (tuple) -- Tuple containing additional arguments to pass to launchctl
• kwargs (dict) -- Dictionary containing arguments to pass to cmd.run_all
• return_stdout (bool) -- A keyword argument.  If true return the stdout of the launchctl command
Returns True if successful, raise CommandExecutionError if not, or the stdout of the launchctl command if requested
Return type bool, str
salt '*' service.launchctl debug org.cups.cupsd
salt.modules.mac_service.list_(name=None, runas=None) Run launchctl list and return the output
• name (str) -- The name of the service to list
Returns If a name is passed returns information about the named service, otherwise returns a list of all services and pids
salt '*' service.list salt '*' service.list org.cups.cupsd
salt.modules.mac_service.loaded(name, runas=None) Check if the specified service is loaded.
• name (str) -- The name of the service to look up
Returns True if the specified service is loaded, otherwise False
salt '*' service.loaded org.cups.cupsd
salt.modules.mac_service.missing(name) The inverse of service.available Check that the given service is not available.
Returns True if the service is not available, otherwise False
salt.modules.mac_service.restart(name, runas=None) Unloads and reloads a launchd service.  Raises an error if the service fails to reload
Returns True if successful
salt '*' service.restart org.cups.cupsd
salt.modules.mac_service.show(name) Show properties of a launchctl service
Parameters name (str) -- Service label, file name, or full path
Returns The service information if the service is found
salt '*' service.show org.cups.cupsd  # service label salt '*' service.show org.cups.cupsd.plist  # file name salt '*' service.show /System/Library/LaunchDaemons/org.cups.cupsd.plist  # full path
salt.modules.mac_service.start(name, runas=None) Start a launchd service.  Raises an error if the service fails to start
NOTE: To start a service in macOS the service must be enabled first. Use service.enable to enable the service.
Returns True if successful or if the service is already running
salt '*' service.start org.cups.cupsd
salt.modules.mac_service.status(name, sig=None, runas=None) Return the status for a service.
NOTE: Previously this function would return a PID for a running service with a PID or 'loaded' for a loaded service without a PID. This was changed to have better parity with other service modules that return True/False.
• name (str) -- Used to find the service from launchctl. Can be the service Label, file name, or path to the service file. (normally a plist)
• sig (str) -- Find the service with status.pid instead. Note that name must still be provided.
Returns True if running, otherwise False.
salt '*' service.status cups
salt.modules.mac_service.stop(name, runas=None) Stop a launchd service.  Raises an error if the service fails to stop
NOTE: Though service.stop will unload a service in macOS, the service will start on next boot unless it is disabled. Use service.disable to disable the service
Returns True if successful or if the service is already stopped
salt '*' service.stop org.cups.cupsd
salt.modules.mac_shadow Manage macOS local directory passwords and policies
Note that it is usually better to apply password policies through the creation of a configuration profile.
salt.modules.mac_shadow.del_password(name) Deletes the account password
Parameters name (str) -- The user name of the account
Raises CommandExecutionError on user not found or any other unknown error
salt.modules.mac_shadow.get_account_created(name) Get the date/time the account was created
Parameters name (str) -- The username of the account
Returns The date/time the account was created (yyyy-mm-dd hh:mm:ss)
salt '*' shadow.get_account_created admin
salt.modules.mac_shadow.get_change(name) Gets the date on which the password expires
Parameters name (str) -- The name of the user account
Returns The date the password will expire
salt '*' shadow.get_change username
salt.modules.mac_shadow.get_expire(name) Gets the date on which the account expires
Returns The date the account expires
salt '*' shadow.get_expire username
salt.modules.mac_shadow.get_last_change(name) Get the date/time the account was changed
Returns The date/time the account was modified (yyyy-mm-dd hh:mm:ss)
salt '*' shadow.get_last_change admin
salt.modules.mac_shadow.get_login_failed_count(name) Get the number of failed login attempts
Returns The number of failed login attempts
salt '*' shadow.get_login_failed_count admin
salt.modules.mac_shadow.get_login_failed_last(name) Get the date/time of the last failed login attempt
Returns The date/time of the last failed login attempt on this account (yyyy-mm-dd hh:mm:ss)
salt '*' shadow.get_login_failed_last admin
salt.modules.mac_shadow.get_maxdays(name) Get the maximum age of the password
Returns The maximum age of the password in days
salt '*' shadow.get_maxdays admin 90
salt.modules.mac_shadow.info(name) Return information for the specified user
Parameters name (str) -- The username
Returns A dictionary containing the user's shadow information
salt '*' shadow.info admin
salt.modules.mac_shadow.set_change(name, date) Sets the date on which the password expires. The user will be required to change their password. Format is mm/dd/yyyy
• name (str) -- The name of the user account
• date (date) -- The date the password will expire. Must be in mm/dd/yyyy format.
salt '*' shadow.set_change username 09/21/2016
salt.modules.mac_shadow.set_expire(name, date) Sets the date on which the account expires. The user will not be able to login after this date. Date format is mm/dd/yyyy
• date (datetime) -- The date the account will expire. Format must be mm/dd/yyyy.
salt '*' shadow.set_expire username 07/23/2015
salt.modules.mac_shadow.set_inactdays(name, days) Set the number if inactive days before the account is locked. Not available in macOS
• name (str) -- The user name
• days (int) -- The number of days
Returns Will always return False until macOS supports this feature.
salt '*' shadow.set_inactdays admin 90
salt.modules.mac_shadow.set_maxdays(name, days) Set the maximum age of the password in days
• name (str) -- The username of the account
• days (int) -- The maximum age of the account in days
salt '*' shadow.set_maxdays admin 90
salt.modules.mac_shadow.set_mindays(name, days) Set the minimum password age in days. Not available in macOS.
salt '*' shadow.set_mindays admin 90
salt.modules.mac_shadow.set_password(name, password) Set the password for a named user (insecure, the password will be in the process list while the command is running)
• name (str) -- The name of the local user, which is assumed to be in the local directory service
• password (str) -- The plaintext password to set
salt '*' mac_shadow.set_password macuser macpassword
salt.modules.mac_shadow.set_warndays(name, days) Set the number of days before the password expires that the user will start to see a warning. Not available in macOS
salt '*' shadow.set_warndays admin 90
salt.modules.mac_softwareupdate Support for the softwareupdate command on MacOS.
salt.modules.mac_softwareupdate.download(name) Download a named update so that it can be installed later with the update or update_all functions
Parameters name (str) -- The update to download.
salt '*' softwareupdate.download <update name>
salt.modules.mac_softwareupdate.download_all(recommended=False, restart=True) Download all available updates so that they can be installed later with the update or update_all functions. It returns a list of updates that are now downloaded.
• recommended (bool) -- If set to True, only install the recommended updates. If set to False (default) all updates are installed.
• restart (bool) -- Set this to False if you do not want to install updates that require a restart. Default is True
Returns A list containing all downloaded updates on the system.
salt '*' softwareupdate.download_all
salt.modules.mac_softwareupdate.get_catalog() New in version 2016.3.0.
Get the current catalog being used for update lookups. Will return a url if a custom catalog has been specified. Otherwise the word 'Default' will be returned
Returns The catalog being used for update lookups
salt '*' softwareupdates.get_catalog
salt.modules.mac_softwareupdate.ignore(name) Ignore a specific program update. When an update is ignored the '-' and version number at the end will be omitted, so "SecUpd2014-001-1.0" becomes "SecUpd2014-001". It will be removed automatically if present. An update is successfully ignored when it no longer shows up after list_updates.
Parameters name -- The name of the update to add to the ignore list.
Ptype  str
salt '*' softwareupdate.ignore <update-name>
salt.modules.mac_softwareupdate.list_available(recommended=False, restart=False, shut_down=False) List all available updates.
• recommended (bool) -- Show only recommended updates.
• restart (bool) -- Show only updates that require a restart.
Returns Returns a dictionary containing the updates
salt '*' softwareupdate.list_available
salt.modules.mac_softwareupdate.list_downloads() Return a list of all updates that have been downloaded locally.
Returns A list of updates that have been downloaded
salt '*' softwareupdate.list_downloads
salt.modules.mac_softwareupdate.list_ignored() List all updates that have been ignored. Ignored updates are shown without the '-' and version number at the end, this is how the softwareupdate command works.
Returns The list of ignored updates
salt '*' softwareupdate.list_ignored
salt.modules.mac_softwareupdate.reset_catalog() New in version 2016.3.0.
Reset the Software Update Catalog to the default.
salt '*' softwareupdates.reset_catalog
salt.modules.mac_softwareupdate.reset_ignored() Make sure the ignored updates are not ignored anymore, returns a list of the updates that are no longer ignored.
Returns True if the list was reset, Otherwise False
salt '*' softwareupdate.reset_ignored
salt.modules.mac_softwareupdate.schedule_enable(enable) Enable/disable automatic update scheduling.
Parameters enable -- True/On/Yes/1 to turn on automatic updates. False/No/Off/0 to turn off automatic updates. If this value is empty, the current status will be returned.
Type   bool str
Returns True if scheduling is enabled, False if disabled
salt '*' softwareupdate.schedule_enable on|off
salt.modules.mac_softwareupdate.schedule_enabled() Check the status of automatic update scheduling.
salt '*' softwareupdate.schedule_enabled
salt.modules.mac_softwareupdate.set_catalog(url) New in version 2016.3.0.
Set the Software Update Catalog to the URL specified
Parameters url (str) -- The url to the update catalog
salt '*' softwareupdates.set_catalog http://swupd.local:8888/index.sucatalog
salt.modules.mac_softwareupdate.update(name) Install a named update.
Parameters name (str) -- The name of the of the update to install.
Returns True if successfully updated, otherwise False
salt '*' softwareupdate.update <update-name>
salt.modules.mac_softwareupdate.update_all(recommended=False, restart=True) Install all available updates. Returns a dictionary containing the name of the update and the status of its installation.
Returns A dictionary containing the updates that were installed and the status of its installation. If no updates were installed an empty dictionary is returned.
salt '*' softwareupdate.update_all
salt.modules.mac_softwareupdate.update_available(name) Check whether or not an update is available with a given name.
Parameters name (str) -- The name of the update to look for
Returns True if available, False if not
salt '*' softwareupdate.update_available <update-name> salt '*' softwareupdate.update_available "<update with whitespace>"
salt.modules.mac_sysctl Module for viewing and modifying sysctl parameters
salt.modules.mac_sysctl.assign(name, value) Assign a single sysctl parameter for this minion
name   The name of the sysctl value to edit.
value  The sysctl value to apply.
salt.modules.mac_sysctl.get(name) Return a single sysctl parameter for this minion
name   The name of the sysctl value to display.
salt.modules.mac_sysctl.persist(name, value, config='/etc/sysctl.conf', apply_change=False) Assign and persist a simple sysctl parameter for this minion
config The location of the sysctl configuration file.
apply_change Default is False; Default behavior only creates or edits the sysctl.conf file. If apply is set to True, the changes are applied to the system.
salt '*' sysctl.persist net.inet.icmp.icmplim 50 salt '*' sysctl.persist coretemp_load NO config=/etc/sysctl.conf
salt.modules.mac_sysctl.show(config_file=False) Return a list of sysctl parameters for this minion
salt.modules.mac_system System module for sleeping, restarting, and shutting down the system on Mac OS X
WARNING: Using this module will enable atrun on the system if it is disabled.
salt.modules.mac_system.get_boot_arch() Get the kernel architecture setting from com.apple.Boot.plist
Returns A string value representing the boot architecture setting
salt '*' system.get_boot_arch
salt.modules.mac_system.get_computer_name() Gets the computer name
Returns The computer name
salt '*' system.get_computer_name
salt.modules.mac_system.get_disable_keyboard_on_lock() Get whether or not the keyboard should be disabled when the X Serve enclosure lock is engaged.
Returns True if disable keyboard on lock is on, False if off
salt '*' system.get_disable_keyboard_on_lock
salt.modules.mac_system.get_remote_events() Displays whether remote apple events are on or off.
Returns True if remote apple events are on, False if off
salt '*' system.get_remote_events
salt.modules.mac_system.get_remote_login() Displays whether remote login (SSH) is on or off.
Returns True if remote login is on, False if off
salt '*' system.get_remote_login
salt.modules.mac_system.get_restart_delay() Get the number of seconds after which the computer will start up after a power failure.
Returns A string value representing the number of seconds the system will delay restart after power loss
salt '*' system.get_restart_delay
salt.modules.mac_system.get_startup_disk() Displays the current startup disk
Returns The current startup disk
salt '*' system.get_startup_disk
salt.modules.mac_system.get_subnet_name() Gets the local subnet name
Returns The local subnet name
salt '*' system.get_subnet_name
salt.modules.mac_system.halt(at_time=None) Halt a running system
Parameters at_time (str) --
Any valid at expression. For example, some valid at expressions could be:
• noon
• midnight
• fri
• 9:00 AM
• 2:30 PM tomorrow
• now + 10 minutes
NOTE: If you pass a time only, with no 'AM/PM' designation, you have to double quote the parameter on the command line. For example: '"14:00"'
salt '*' system.halt salt '*' system.halt 'now + 10 minutes'
salt.modules.mac_system.list_startup_disks() List all valid startup disks on the system.
Returns A list of valid startup disks
salt '*' system.list_startup_disks
salt.modules.mac_system.restart(at_time=None) Restart the system
salt '*' system.restart salt '*' system.restart '12:00 PM fri'
salt.modules.mac_system.set_boot_arch(arch='default') Set the kernel to boot in 32 or 64 bit mode on next boot.
NOTE: When this function fails with the error changes to kernel architecture failed to save!, then the boot arch is not updated.  This is either an Apple bug, not available on the test system, or a result of system files being locked down in macOS (SIP Protection).
Parameters arch (str) --
A string representing the desired architecture. If no value is passed, default is assumed. Valid values include:
• i386
• default
salt '*' system.set_boot_arch i386
salt.modules.mac_system.set_computer_name(name) Set the computer name
Parameters name (str) -- The new computer name
salt '*' system.set_computer_name "Mike's Mac"
salt.modules.mac_system.set_disable_keyboard_on_lock(enable) Get whether or not the keyboard should be disabled when the X Serve enclosure lock is engaged.
Parameters enable (bool) -- True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively
salt '*' system.set_disable_keyboard_on_lock False
salt.modules.mac_system.set_remote_events(enable) Set whether the server responds to events sent by other computers (such as AppleScripts)
salt '*' system.set_remote_events On
salt.modules.mac_system.set_remote_login(enable) Set the remote login (SSH) to either on or off.
salt '*' system.set_remote_login True
salt.modules.mac_system.set_restart_delay(seconds) Set the number of seconds after which the computer will start up after a power failure.
WARNING: This command fails with the following error:
Error, IOServiceOpen returned 0x10000003
The setting is not updated. This is an apple bug. It seems like it may only work on certain versions of Mac Server X. This article explains the issue in more detail, though it is quite old.
http://lists.apple.com/archives/macos-x-server/2006/Jul/msg00967.html
Parameters seconds (int) -- The number of seconds. Must be a multiple of 30
salt '*' system.set_restart_delay 180
salt.modules.mac_system.set_startup_disk(path) Set the current startup disk to the indicated path. Use system.list_startup_disks to find valid startup disks on the system.
Parameters path (str) -- The valid startup disk path
salt '*' system.set_startup_disk /System/Library/CoreServices
salt.modules.mac_system.set_subnet_name(name) Set the local subnet name
Parameters name (str) -- The new local subnet name
NOTE: Spaces are changed to dashes. Other special characters are removed.
The following will be set as 'Mikes-Mac' salt '*' system.set_subnet_name "Mike's Mac"
salt.modules.mac_system.shutdown(at_time=None) Shutdown the system
salt '*' system.shutdown salt '*' system.shutdown 'now + 1 hour'
salt.modules.mac_system.sleep(at_time=None) Sleep the system. If a user is active on the system it will likely fail to sleep.
salt '*' system.sleep salt '*' system.sleep '10:00 PM'
salt.modules.mac_timezone Module for editing date/time settings on macOS New in version 2016.3.0.
salt.modules.mac_timezone.get_date() Displays the current date
Returns the system date
salt '*' timezone.get_date
salt.modules.mac_timezone.get_hwclock() Get current hardware clock setting (UTC or localtime)
salt '*' timezone.get_hwclock
salt.modules.mac_timezone.get_offset() Displays the current time zone offset
Returns The current time zone offset
salt '*' timezone.get_offset
salt.modules.mac_timezone.get_time() Get the current system time.
Returns The current time in 24 hour format
salt '*' timezone.get_time
salt.modules.mac_timezone.get_time_server() Display the currently set network time server.
Returns the network time server
salt '*' timezone.get_time_server
salt.modules.mac_timezone.get_using_network_time() Display whether network time is on or off
Returns True if network time is on, False if off
salt '*' timezone.get_using_network_time
salt.modules.mac_timezone.get_zone() Displays the current time zone
Returns The current time zone
salt '*' timezone.get_zone
salt.modules.mac_timezone.get_zonecode() Displays the current time zone abbreviated code
Returns The current time zone code
salt '*' timezone.get_zonecode
salt.modules.mac_timezone.list_zones() Displays a list of available time zones. Use this list when setting a time zone using timezone.set_zone
Returns a list of time zones
salt '*' timezone.list_zones
salt.modules.mac_timezone.set_date(date) Set the current month, day, and year
Parameters date (str) --
The date to set. Valid date formats are:
• %m:%d:%y
• %m:%d:%Y
• %m/%d/%y
• %m/%d/%Y
Raises SaltInvocationError on Invalid Date format
Raises CommandExecutionError on failure
salt '*' timezone.set_date 1/13/2016
salt.modules.mac_timezone.set_hwclock(clock) Sets the hardware clock to be either UTC or localtime
salt '*' timezone.set_hwclock UTC
salt.modules.mac_timezone.set_time(time) Sets the current time. Must be in 24 hour format.
Parameters time (str) -- The time to set in 24 hour format.  The value must be double quoted. ie: '"17:46"'
Raises SaltInvocationError on Invalid Time format
salt '*' timezone.set_time '"17:34"'
salt.modules.mac_timezone.set_time_server(time_server='time.apple.com') Designates a network time server. Enter the IP address or DNS name for the network time server.
Parameters time_server -- IP or DNS name of the network time server. If nothing is passed the time server will be set to the macOS default of 'time.apple.com'
Type   str
salt '*' timezone.set_time_server time.acme.com
salt.modules.mac_timezone.set_using_network_time(enable) Set whether network time is on or off.
Parameters enable -- True to enable, False to disable. Can also use 'on' or 'off'
Type   str bool
salt '*' timezone.set_using_network_time True
salt.modules.mac_timezone.set_zone(time_zone) Set the local time zone. Use timezone.list_zones to list valid time_zone arguments
Parameters time_zone (str) -- The time zone to apply
Raises SaltInvocationError on Invalid Timezone
salt '*' timezone.set_zone America/Denver
salt.modules.mac_timezone.zone_compare(time_zone) Compares the given timezone name with the system timezone name.
Returns True if they are the same, False if not
salt '*' timezone.zone_compare America/Boise
salt.modules.mac_user Manage users on Mac OS 10.7+
IMPORTANT: If you feel that Salt should be using this module to manage users on a minion, and it is using a different module (or gives an error similar to 'user.info' is not available), see here.
salt.modules.mac_user.add(name, uid=None, gid=None, groups=None, home=None, shell=None, fullname=None, createhome=True, **kwargs) Add a user to the minion
salt '*' user.add name <uid> <gid> <groups> <home> <shell>
salt.modules.mac_user.chfullname(name, fullname) Change the user's Full Name
salt '*' user.chfullname foo 'Foo Bar'
salt.modules.mac_user.chgid(name, gid) Change the default group of the user
salt '*' user.chgid foo 4376
salt.modules.mac_user.chgroups(name, groups, append=False) Change the groups to which the user belongs. Note that the user's primary group does not have to be one of the groups passed, membership in the user's primary group is automatically assumed.
groups Groups to which the user should belong, can be passed either as a python list or a comma-separated string
append Instead of removing user from groups not included in the groups parameter, just add user to any groups for which they are not members
salt '*' user.chgroups foo wheel,root
salt.modules.mac_user.chhome(name, home, **kwargs) Change the home directory of the user
salt '*' user.chhome foo /Users/foo
salt.modules.mac_user.chshell(name, shell) Change the default shell of the user
salt '*' user.chshell foo /bin/zsh
salt.modules.mac_user.chuid(name, uid) Change the uid for a named user
salt '*' user.chuid foo 4376
salt.modules.mac_user.delete(name, remove=False, force=False) Remove a user from the minion
salt '*' user.delete name remove=True force=True
salt.modules.mac_user.disable_auto_login() New in version 2016.3.0.
Disables auto login on the machine
salt '*' user.disable_auto_login
salt.modules.mac_user.enable_auto_login(name, password) New in version 2016.3.0.
Configures the machine to auto login with the specified user
• name (str) -- The user account use for auto login
The password to user for auto login
salt '*' user.enable_auto_login stevej
salt.modules.mac_user.get_auto_login() New in version 2016.3.0.
Gets the current setting for Auto Login
Returns If enabled, returns the user name, otherwise returns False
Return type str, bool
salt '*' user.get_auto_login
salt.modules.mac_user.getent(refresh=False) Return the list of all info for all users
salt '*' user.getent
salt.modules.mac_user.info(name) Return user information
salt '*' user.info root
salt.modules.mac_user.list_groups(name) Return a list of groups the named user belongs to.
name The name of the user for which to list groups. Starting in Salt 2016.11.0, all groups for the user, including groups beginning with an underscore will be listed.
salt '*' user.list_groups foo
salt.modules.mac_user.list_users() Return a list of all users
salt '*' user.list_users
salt.modules.mac_user.primary_group(name) Return the primary group of the named user
salt '*' user.primary_group saltadmin
salt.modules.mac_user.rename(name, new_name) Change the username for a named user
salt '*' user.rename name new_name
salt.modules.mac_xattr This module allows you to manage extended attributes on files or directories
salt '*' xattr.list /path/to/file
salt.modules.mac_xattr.clear(path) Causes the all attributes on the file/directory to be removed
Parameters path (str) -- The file(s) to get attributes from
Raises CommandExecutionError on file not found or any other unknown error
salt '*' xattr.delete /path/to/file "com.test.attr"
salt.modules.mac_xattr.delete(path, attribute) Removes the given attribute from the file
• path (str) -- The file(s) to get attributes from
• attribute (str) -- The attribute name to be deleted from the file/directory
Raises CommandExecutionError on file not found, attribute not found, and any other unknown error
salt.modules.mac_xattr.list_(path, **kwargs) List all of the extended attributes on the given file/directory
• hex (bool) -- Return the values with forced hexadecimal values
Returns A dictionary containing extended attributes and values for the given file
salt '*' xattr.list /path/to/file salt '*' xattr.list /path/to/file hex=True
salt.modules.mac_xattr.read(path, attribute, **kwargs) Read the given attributes on the given file/directory
• path (str) -- The file to get attributes from
• attribute (str) -- The attribute to read
Returns A string containing the value of the named attribute
salt '*' xattr.read /path/to/file com.test.attr salt '*' xattr.read /path/to/file com.test.attr hex=True
salt.modules.mac_xattr.write(path, attribute, value, **kwargs) Causes the given attribute name to be assigned the given value
• attribute (str) -- The attribute name to be written to the file/directory
• value (str) -- The value to assign to the given attribute
• hex (bool) -- Set the values with forced hexadecimal values
salt '*' xattr.write /path/to/file "com.test.attr" "value"
salt.modules.macdefaults Set defaults on Mac OS
salt.modules.macdefaults.delete(domain, key, user=None) Delete a default from the system
salt '*' macdefaults.delete com.apple.CrashReporter DialogType
salt '*' macdefaults.delete NSGlobalDomain ApplePersistence
domain The name of the domain to delete from
key    The key of the given domain to delete
user   The user to delete the defaults with
salt.modules.macdefaults.read(domain, key, user=None) Read a default from the system
salt '*' macdefaults.read com.apple.CrashReporter DialogType
salt '*' macdefaults.read NSGlobalDomain ApplePersistence
domain The name of the domain to read from
key    The key of the given domain to read from
user   The user to read the defaults as
salt.modules.macdefaults.write(domain, key, value, type='string', user=None) Write a default to the system
salt '*' macdefaults.write com.apple.CrashReporter DialogType Server
salt '*' macdefaults.write NSGlobalDomain ApplePersistence True type=bool
domain The name of the domain to write to
key    The key of the given domain to write to
value  The value to write to the given key
type   The type of value to be written, valid types are string, data, int[eger], float, bool[ean], date, array, array-add, dict, dict-add
user   The user to write the defaults to
salt.modules.macpackage Install pkg, dmg and .app applications on macOS minions.
salt.modules.macpackage.get_mpkg_ids(mpkg) Attempt to get the package IDs from a mounted .mpkg file
Parameters mpkg (str) -- The location of the mounted mpkg file
Returns List of package IDs
salt '*' macpackage.get_mpkg_ids /dev/disk2
salt.modules.macpackage.get_pkg_id(pkg) Attempt to get the package ID from a .pkg file
Parameters pkg (str) -- The location of the pkg file
Returns List of all of the package IDs
salt '*' macpackage.get_pkg_id /tmp/test.pkg
salt.modules.macpackage.install(pkg, target='LocalSystem', store=False, allow_untrusted=False) Install a pkg file
• pkg (str) -- The package to install
• target (str) -- The target in which to install the package to
• store (bool) -- Should the package be installed as if it was from the store?
• allow_untrusted (bool) -- Allow the installation of untrusted packages?
Returns A dictionary containing the results of the installation
salt '*' macpackage.install test.pkg
salt.modules.macpackage.install_app(app, target='/Applications/') Install an app file by moving it into the specified Applications directory
• app (str) -- The location of the .app file
• target (str) -- The target in which to install the package to Default is ''/Applications/''
Returns The results of the rsync command
salt '*' macpackage.install_app /tmp/tmp.app /Applications/
salt.modules.macpackage.installed_pkgs() Return the list of installed packages on the machine
Returns List of installed packages
salt '*' macpackage.installed_pkgs
salt.modules.macpackage.mount(dmg) Attempt to mount a dmg file to a temporary location and return the location of the pkg file inside
Parameters dmg (str) -- The location of the dmg file to mount
Tuple containing the results of the command along with the mount point
salt '*' macpackage.mount /tmp/software.dmg
salt.modules.macpackage.uninstall_app(app) Uninstall an app file by removing it from the Applications directory
Parameters app (str) -- The location of the .app file
salt '*' macpackage.uninstall_app /Applications/app.app
salt.modules.macpackage.unmount(mountpoint) Attempt to unmount a dmg file from a temporary location
Parameters mountpoint (str) -- The location of the mount point
Returns The results of the hdutil detach command
salt '*' macpackage.unmount /dev/disk2
salt.modules.makeconf Support for modifying make.conf under Gentoo
salt.modules.makeconf.append_cflags(value) Add to or create a new CFLAGS in the make.conf
Return a dict containing the new value for variable:
{'<variable>': {'old': '<old-value>', 'new': '<new-value>'}}
salt '*' makeconf.append_cflags '-pipe'
salt.modules.makeconf.append_cxxflags(value) Add to or create a new CXXFLAGS in the make.conf
salt '*' makeconf.append_cxxflags '-pipe'
salt.modules.makeconf.append_emerge_default_opts(value) Add to or create a new EMERGE_DEFAULT_OPTS in the make.conf
salt '*' makeconf.append_emerge_default_opts '--jobs'
salt.modules.makeconf.append_features(value) Add to or create a new FEATURES in the make.conf
salt '*' makeconf.append_features 'webrsync-gpg'
salt.modules.makeconf.append_gentoo_mirrors(value) Add to or create a new GENTOO_MIRRORS in the make.conf
salt '*' makeconf.append_gentoo_mirrors 'http://distfiles.gentoo.org'
salt.modules.makeconf.append_makeopts(value) Add to or create a new MAKEOPTS in the make.conf
salt '*' makeconf.append_makeopts '-j3'
salt.modules.makeconf.append_var(var, value) Add to or create a new variable in the make.conf
salt '*' makeconf.append_var 'LINGUAS' 'en'
salt.modules.makeconf.cflags_contains(value) Verify if CFLAGS variable contains a value in make.conf
Return True if value is set for var
salt '*' makeconf.cflags_contains '-pipe'
salt.modules.makeconf.chost_contains(value) Verify if CHOST variable contains a value in make.conf
salt '*' makeconf.chost_contains 'x86_64-pc-linux-gnu'
salt.modules.makeconf.cxxflags_contains(value) Verify if CXXFLAGS variable contains a value in make.conf
salt '*' makeconf.cxxflags_contains '-pipe'
salt.modules.makeconf.emerge_default_opts_contains(value) Verify if EMERGE_DEFAULT_OPTS variable contains a value in make.conf
salt '*' makeconf.emerge_default_opts_contains '--jobs'
salt.modules.makeconf.features_contains(value) Verify if FEATURES variable contains a value in make.conf
salt '*' makeconf.features_contains 'webrsync-gpg'
salt.modules.makeconf.gentoo_mirrors_contains(value) Verify if GENTOO_MIRRORS variable contains a value in make.conf
salt '*' makeconf.gentoo_mirrors_contains 'http://distfiles.gentoo.org'
salt.modules.makeconf.get_cflags() Get the value of CFLAGS variable in the make.conf
Return the value of the variable or None if the variable is not in the make.conf
salt '*' makeconf.get_cflags
salt.modules.makeconf.get_chost() Get the value of CHOST variable in the make.conf
salt '*' makeconf.get_chost
salt.modules.makeconf.get_cxxflags() Get the value of CXXFLAGS variable in the make.conf
salt '*' makeconf.get_cxxflags
salt.modules.makeconf.get_emerge_default_opts() Get the value of EMERGE_DEFAULT_OPTS variable in the make.conf
salt '*' makeconf.get_emerge_default_opts
salt.modules.makeconf.get_features() Get the value of FEATURES variable in the make.conf
salt '*' makeconf.get_features
salt.modules.makeconf.get_gentoo_mirrors() Get the value of GENTOO_MIRRORS variable in the make.conf
salt '*' makeconf.get_gentoo_mirrors
salt.modules.makeconf.get_makeopts() Get the value of MAKEOPTS variable in the make.conf
salt '*' makeconf.get_makeopts
salt.modules.makeconf.get_sync() Get the value of SYNC variable in the make.conf
salt '*' makeconf.get_sync
salt.modules.makeconf.get_var(var) Get the value of a variable in make.conf
Return the value of the variable or None if the variable is not in make.conf
salt '*' makeconf.get_var 'LINGUAS'
salt.modules.makeconf.makeopts_contains(value) Verify if MAKEOPTS variable contains a value in make.conf
salt '*' makeconf.makeopts_contains '-j3'
salt.modules.makeconf.remove_var(var) Remove a variable from the make.conf
Return a dict containing the new value for the variable:
salt '*' makeconf.remove_var 'LINGUAS'
salt.modules.makeconf.set_cflags(value) Set the CFLAGS variable
salt '*' makeconf.set_cflags '-march=native -O2 -pipe'
salt.modules.makeconf.set_chost(value) Set the CHOST variable
salt '*' makeconf.set_chost 'x86_64-pc-linux-gnu'
salt.modules.makeconf.set_cxxflags(value) Set the CXXFLAGS variable
salt '*' makeconf.set_cxxflags '-march=native -O2 -pipe'
salt.modules.makeconf.set_emerge_default_opts(value) Set the EMERGE_DEFAULT_OPTS variable
salt '*' makeconf.set_emerge_default_opts '--jobs'
salt.modules.makeconf.set_gentoo_mirrors(value) Set the GENTOO_MIRRORS variable
salt '*' makeconf.set_gentoo_mirrors 'http://distfiles.gentoo.org'
salt.modules.makeconf.set_makeopts(value) Set the MAKEOPTS variable
salt '*' makeconf.set_makeopts '-j3'
salt.modules.makeconf.set_sync(value) Set the SYNC variable
salt '*' makeconf.set_sync 'rsync://rsync.namerica.gentoo.org/gentoo-portage'
salt.modules.makeconf.set_var(var, value) Set a variable in the make.conf
salt '*' makeconf.set_var 'LINGUAS' 'en'
salt.modules.makeconf.sync_contains(value) Verify if SYNC variable contains a value in make.conf
salt '*' makeconf.sync_contains 'rsync://rsync.namerica.gentoo.org/gentoo-portage'
salt.modules.makeconf.trim_cflags(value) Remove a value from CFLAGS variable in the make.conf
salt '*' makeconf.trim_cflags '-pipe'
salt.modules.makeconf.trim_cxxflags(value) Remove a value from CXXFLAGS variable in the make.conf
salt '*' makeconf.trim_cxxflags '-pipe'
salt.modules.makeconf.trim_emerge_default_opts(value) Remove a value from EMERGE_DEFAULT_OPTS variable in the make.conf
salt '*' makeconf.trim_emerge_default_opts '--jobs'
salt.modules.makeconf.trim_features(value) Remove a value from FEATURES variable in the make.conf
salt '*' makeconf.trim_features 'webrsync-gpg'
salt.modules.makeconf.trim_gentoo_mirrors(value) Remove a value from GENTOO_MIRRORS variable in the make.conf
salt '*' makeconf.trim_gentoo_mirrors 'http://distfiles.gentoo.org'
salt.modules.makeconf.trim_makeopts(value) Remove a value from MAKEOPTS variable in the make.conf