Wilson Mar bio photo

Wilson Mar

Hello. Join me!

Email me Calendar Skype call 310 320-7878

LinkedIn Twitter Gitter Google+ Youtube

Github Stackoverflow Pinterest

Getting started


Overview

Boot-up

During boot-up (Apple logo):

  • Hold down the start button for a hard reset when the keyboard and mouse are not responsive.
  • Hold down C to boot from CD.
  • Hold down N to boot from network (do a NetBoot from a network server).
  • Hold down option (alt) key for the Mac's Startup Manager to select a (USB) startup disk.
  • Hold down shift key to boot in Safe Mode (which does not load start-up items).
  • Hold down ⌘ (command) + R for the Recovery menu.
  • Hold down ⌘ (command) + option + P + R to reset Parameter RAM (PRAM).

After powering up the computer, a folder with a question mark means that a boot folder (described below) was not found on the hard disk.

If pressing the start button does not work:

  1. Unplug the magsafe power cable.
  2. Hold down the power button for about 10 seconds and keeping pressing.
  3. While still holding the power button down, insert the magsafe power cable and hold it for another 10 sec.
  4. Release the power button and make a "normal" press as if you would normally turn on your computer.

If that doesn’t work then try to remove one RAM memory chip and switch places before repeating the above.

See https://www.tekrevue.com/tip/mac-startup-options/

Recovery menu

Prior to OS X Lion in 2011, one had to insert an OS X DVD or USB installer. That was a hassle.

With Lion onwards, Apple added a 2GB hidden recovery partition on the Mac’s hard drive to boot up in Recovery Mode.

“macOS Utilities” appears:

macos-bootup-utils-640x347-74954.jpg

Open a Terminal by clicking “Utilities” menu item:

macos-bootup-utils-640x196-39501.jpg

Also, OS X Internet Recovery loads the recovery information directly from Apple’s servers.

Boot loader on Mac

MacOS does not use the boot loader other Linux machines store in the /boot folder.

MacOS machines boots from the boot.efi binary file within cd /System/Library/CoreServices. This is for Intel Macs. Older PowerPC Macs (and an old enough version of OS X) boots from file BootX.

The MacOS kernel, as of Yosemite (version 10.10), is at
/System/Library/Kernels/kernel, but was just /mach_kernel in older versions.

Apple-supplied loadable kernel modules (known as kernel extensions or kexts) are found in
/System/Library/Extensions/

Third-party extensions are in
/Library/Extensions/.

See this Apple article.

Bootable Installer

https://support.apple.com/en-us/HT201372
Create a bootable installer for macOS

Boot up with the installer Disc.

Start-up items

MacOS provices its launchctl utility for interaction with the OS X init script system deamon launchd which controls the services that start up on boot.

  1. List what launch scripts are currently loaded:

    launchctl list | wc -l

    375 shows up. Remove the “| wc -l” to see the list.

    Launchd scripts are stored in several folders:

    • ~/Library/LaunchAgents
    • /Library/LaunchAgents
    • /Library/LaunchDaemons
    • /System/Library/LaunchAgents
    • /System/Library/LaunchDaemons

  2. To stop and unload running scripts:

    sudo launchctl unload [path/to/script] -w 

    The -w flag removes the script permanently from your boot sequence.

    I like to run this one on all the auto-update “ helpers”=”” created=”” by=”” adobe=”” apps=”” and=”” microsoft=”” office.<=”” p=””>

  3. To see what goes into a launch agent or daemon, there’s a great blog post that walks you through the file format at:

    http://paul.annesley.cc/2012/09/mac-os-x-launchd-is-cool

    “I particularly like the idea of using QueueDirectories to monitor and act upon files dropped into a directory, without having to run any extra daemons. The files could be uploaded to S3, transcoded to a different video format, gzipped… anything.”

  4. Learn how to write your own launchd scripts, explained at Apple’s Developer site.

  5. If you’d prefer a GUI rather than using the command line, buy the $10 Lingon app from:

    http://www.peterborgapps.com/lingon

  6. Consider setting up bash scripts to run periodically or at timed intervals in the background, similar to cron jobs on Linux. For example, to start the Apache web server start automatically when you turn on your Mac:

    
    sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
    

    Plists

    Plist files are how Macs define services.

More on OSX

This is one of a series on Mac OSX: