The Mac, short for Macintosh (Q75687 on
Wikidata), is a brand of computer that has been continuously released by
Apple. Although not as popular as Microsoft's Windows line of operating
systems, Mac is certainly no underdog.
Last updated February 2021
Sometimes you need your Mac to stay awake to complete a long task like compiling or transferring data.
Screen off, still running
Keyboard shortcut to lock your Mac, turn off the screen, and continue running:
⌘ + control + q
Screen on, still running
This command won't let your Mac sleep until you
control + c the terminal. Open a terminal and type:
caffeinate -disu
Last updated February 2021
Launch agents/daemons are scripts that tell the system to run executables at user login. These are mostly background daemons such as software updaters and are mostly harmless. They are placed in the following locations:
/Library/LaunchAgents/Library/LaunchDaemons~/Library/LaunchAgentsDespite all the protections in modern macOS, apps can still freely place launch agents as they desire without any prompt from the user. My biggest frustration comes from Adobe, which insists on launching a background Creative Cloud updater that spawns half a dozen other processes.
Clean-up Script
I have written a script called agentlookout that when
ran cleans up your launch agents/daemons and removes ones not
whitelisted. It's a very simple script that I recommend running once in
a while and especially after launching Chrome and any Adobe products. I
wouldn't recommend automating this process so that you can catch any
launch agents; you don't mind sticking around as you accumulate more
apps on your Mac.
When ran it looks like this:
Will delete unrecognized launch agents: - /Users/harry/Library/LaunchAgents/com.adobe.GC.Invoker-1.0.plist - /Users/harry/Library/LaunchAgents/com.google.keystone.agent.plist - /Users/harry/Library/LaunchAgents/com.google.keystone.xpcservice.plist Delete? [y/n]
Code
/usr/local/bin/agentlook,
and remember to give execute permission.#!/bin/bash # Launch agents that won't be deleted ALLOWED_LAUNCH_AGENTS=("com.dropbox.DropboxMacUpdate.agent.plist" "com.tapbots.Pastebot.PasteService.plist") delete=() shopt -s nullglob launch_agent_check() { for f in $1; do filename=$(basename "$f") if [[ ! " ${ALLOWED_LAUNCH_AGENTS[@]} " =~ " ${filename} " ]]; then delete+=("$f") fi done } launch_agent_check "/Library/LaunchAgents/*.plist" launch_agent_check "/Library/LaunchDaemons/*.plist" launch_agent_check "$HOME/Library/LaunchAgents/*.plist" if [ "${#delete[@]}" -eq 0 ]; then echo "No launch agents found, exiting..." exit 0 fi echo "Will delete unrecognized launch agents:" for f in ${delete[@]}; do echo " - $f" done delete_agents() { sudo rm "${delete[@]}" } while true; do read -p "Delete? [y/n] " yn case $yn in [Yy]* ) delete_agents; break;; [Nn]* ) exit;; * ) echo "Please answer yes/no";; esac done
.DS_StoreLast updated February 2021
.DS_Store is a file on Mac that Finder places within
directories in order to store directory-specific preferences. It serves
a purpose and is mostly harmless, but sometimes you need to delete all
of them within a directory. This is a quick one liner to do that:
find . -name «.DS_Store» -type f -delete
For a more permanent and reliable solution, try excluding
.DS_Store with the tool you are using to archive or
transfer files.
Last updated February 2021
Launchpad gets messy; this command resets the layout. You may need to open Launchpad two times before all icons display again. Enter in a terminal:
defaults write com.apple.dock ResetLaunchPad -bool true && killall Dock
Last updated February 2021
This has been tested on OS X Snow Leopard.
Confirm that EFI is enabled in the VM settings; if you select the default OS X template within VirtualBox, then this will already be configured.
Enter the following commands in your terminal:
VBoxManage modifyvm «Mac» –cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff VBoxManage modifyvm «Mac» –cpu-profile «Intel Core i7-6700K» VBoxManage setextradata «Mac» «VBoxInternal/Devices/efi/0/Config/DmiSystemProduct» «iMac11,3» VBoxManage setextradata «Mac» «VBoxInternal/Devices/efi/0/Config/DmiSystemVersion» «1.0» VBoxManage setextradata «Mac» «VBoxInternal/Devices/efi/0/Config/DmiBoardProduct» «Iloveapple» VBoxManage setextradata «Mac» «VBoxInternal/Devices/smc/0/Config/DeviceKey» «ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc» VBoxManage setextradata «Mac» «VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC» 1
Boot the VM and you should be loaded into the EFI shell.
Type exit in the shell.
Choose Boot Maintenance Manager, then
Boot From File.
Select the entry listing HFS+, then navigate through
the file hierarchy like so:
System/Library/CoreServices/boot.efi.
Once you've found boot.efi, press return to boot the
installer.
Last updated February 2021
Launch daemons are script files that are managed by the system that
have versatile options for running them; the system tracks «loaded»
daemons as to avoid running duplicates. They are located at
/Library/LaunchDaemons/.
Starting (run as root)
launchctl load /Library/LaunchDaemons/com.example.daemon.plist
Stopping (run as root)
launchctl unload /Library/LaunchDaemons/com.example.daemon.plist
Last updated February 2021
General information such as what launch daemons are and how to manage them can be found at Mac Launch Daemons.
/Library/LaunchDaemons/com.webserver.daemon.plist
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd >
Label - name of the daemonProgramArguments - command and arguments to callEnvironmentVariables - optional list of environment
variables used when running ProgramArguments,
PATH key and value may be needed to run some scriptsRunAtLoad - run when user logs in, most likely
wantedWorkingDirectory - directory to execute fromUserName - username to run the command file as, see
below for more optionsStandardOutPath - optional log file helpful for
debuggingStandardErrorPath - optional error log fileStandardOutPath and StandardErrorPath are
both optional. NOTE: It is necessary to create the
subdirectory under /var/log,
e.g. mkdir -p /var/log/webserver.
Last updated February 2021
Daemon users are usually used alongside launch daemons. Find out what they are and how to create them.
In this example a daemon user named _webserver is
created. Make sure you replace this with your own new daemon
username.
Decide on a name for your user and prefix it with an underscore;
this will also be the name for a new group the user will be a member of.
For example, _webserver.
$ sudo dscl Entering interactive mode... (type «help» for commands)
Move to the base folder:
> cd /Local/Default/
List all groups and find an unused GID, preferably less than 500:
/Local/Default > ls Groups gid
Create a group and assign the GID found in the previous step. In this example, the GID found is 300, but it may differ for you:
/Local/Default > create Groups/_webserver /Local/Default > create Groups/_webserver PrimaryGroupID 300
List all users and find an unused UID, preferably less than 500; this can be different from your GID:
/Local/Default > ls Users uid
Create a user and assign the UID found in the previous step. In this example, the UID found is 300, but it may differ for you:
/Local/Default > create Users/_webserver UserShell /bin/bash /Local/Default > create Users/_webserver UniqueID 300
Set the user's group ID to the GID previously found and assigned to the group; alongside this, also set the user's home directory:
/Local/Default > create Users/_webserver PrimaryGroupID 300 /Local/Default > create Users/_webserver NFSHomeDirectory /Users/_webserver
Add the user to the previously created group:
/Local/Default > append Groups/_webserver GroupMembership _webserver
Exit out of interactive user mode:
/Local/Default > exit
Goodbye
sudo dscl . delete /Users/\_webserver AuthenticationAuthority
sudo dscl . create /Users/\_webserver Password "\*"
sudo mkdir /Users/\_webserver
sudo chown \_webserver:\_webserver /Users/\_webserver
Instructions distilled from a similar document in the Minecraft Wiki
Last updated February 2021
With a standard Homebrew install, it is located at:
/usr/local/etc/nginx/nginx.conf
It has permissions of -rw-r--r-- USER:admin.
This page was last edited on 2026-09-25 02:04:49.
All original text, code, images and content on the MDKwiki is CC0 1.0 - we have a Git and an RSS feed that can be followed.
Let there be peace on Earth.