Wilson Mar bio photo

Wilson Mar

Hello. Hire me!

Email me Calendar Skype call 310 320-7878

LinkedIn Twitter Gitter Google+ Youtube

Github Stackoverflow Pinterest

It’s stylish because it’s expensive

Overview

Register it. Now.

Find your serial number and enter it in Apple Online Service Assistant to confirm your warranty and support status.

Identify your Mac for tear-down instructions such as for MacBook Pro A1398 (Retina, 15-inch,Early 2015).

MacOS Sierra supports these hardware models:

Case

Dropping a Macbook can crack the screen.

But a protective case adds to weight.

Screws

Apple uses tiny screws for their products. Screws for older Mac Book Pro’s have a + pattern requiring a 1.5mm screwdriver. Screws for newer Mac Book Pro’s have a 5-point design which require a screwdriver called the “pentalobe” Torx T6. iPhones have requiring a T6 Torx 0.6 screwdriver. The Phillips PH#00 is a little too big.

Screws on the black hindge edge are longer.

Older Mac Book Pros have 2.5” hard drives. Video:
The Seagate Thunderbolt Adapter ($99) provides the fastest connection.
The Seagate USB 3.0/2.0 Upgrade Cable costs just $19.99.

Drives in newer Mac Book Pros have SSD chip cards instead of drives.

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

After powering up the computer, a folder with a question mark means that a boot folder is not found on the hard disk.

Boot up with the installer Disc.

Cooling

The Macbook Pro has always had a history of running hot.

If you’re only using power when plugging into the Mac’s USB hub connector, use an external USB power that plugs straight into the wall outlet.

Use of an external monitor may also cause the fan to engage.

Battery

https://macdaddy.io/mac-battery-guru/ displays the current battery drain.

macbook-hardware-battery-307x366

Wrist Rest Cushion

I like some cushioning for where my palm touches the cold hard keyboard and on sharp edges of the Mac Pro Retina laptop.

In https://support.apple.com/en-us/HT203671 Apple recommends against use of palm pads, as the pads puts uneven pressure on the display glass.

The pads also cause a line of dust on the screen.

Unlike the much better looking leather $29 TwelveSouth, the $9.99 GRIFITI Palm Pads is removeable (rests on rather than glued on the keyboard), so it can be taken off before closing the cover.

System Profiler File Redirect

MacOS has a single command to obtain details about your machine in a single file.

Good to provide tech support when you’re dealing with a nasty problem.

There is a lot of information, so we use it to show use of some command-line kung fu:

  1. Redirect the output to a dated file using the > symbol, but change the sample date as you type this command:

    cd ~
    system_profiler >system_profiler_2017_06_11
    

    This takes a while to run.

  2. In the Terminal, highlight the file name and press Ctrl+C to copy it to your Clipboard.
  3. To count the number of lines in that output file above:

    wc system_profiler_2017_06_11
    

    The response I got:

    72759  346086 3353663 system_profiler_2017_06_11
    

    In the example above, 72759 is the number of lines, 13346086 is the number of words, and 3353663 is the number of characters.

    SIDE NOTE: This is more than the number (64922) obtained from the nl command which adds a line counter as it displays each line.

System Preferences

  1. If you don't see the Apple icon at the top of the screen, move the cursor to the very top of the screen for a few seconds.
  2. Click on the Apple icon at the upper left corner.
  3. Select System Preferences.

mac-system-prefs-10 12 5-285x280-35kb

QUESTION: Where are preferences stored?

sysctl -a hw

Display

  1. Within System Perferences:
  2. Click Displays.
  3. Set Resolution to Scaled
  4. Test Page reports the screen and resolution along with browser version.
  5. The Mac Pro 15 inch retina display is preconfigured to a screen resolution of 1440 wide x 900 high,
    but a browser window of 1440 x 738.
  6. Click one of the 5 resolutions between Larger Text and More Space.

Startup Sound Suppressor Applescript

Until Apple realizes how annoying it is to have that start-up sound on a Mac, create in the /Library/Scripts folder shell scripts containing osacript (Applescript) commands to mute sound automatically before reboot, and un-mute after reboot.

  1. Open a terminal and type in nano. Press Enter.

    Type this in the nano editor that pops up this shell script (starting with the she-bang #! characters):

    #!/bin/bash
    osascript -e 'set volume with output muted'
    
  2. Press Ctrl+O, then when it asks you for the filename type in

    ~/Documents/mute.sh

  3. Hit Enter to save the file. This puts the mute script in your Documents folder (don’t worry, we’re going to move it later).

  4. Create the unmute.sh script:

    #!/bin/bash
    osascript -e 'set volume without output muted'
    

    (In older versions the unmute script instead has

    set volume with output unmuted.

  5. Press Ctrl+X, press Y to agree, then type in

    ~/Documents/unmute.sh
    
  6. Hit Return to save the new file, and nano should quit.

  7. To make the scripts executable, run the following commands in the Terminal, hitting Enter after each one

    sudo chmod u+x ~/Documents/mute.sh
    sudo chmod u+x ~/Documents/unmute.sh
    sudo mv ~/Documents/mute.sh /Library/Scripts/
    sudo mv ~/Documents/unmute.sh /Library/Scripts/
    
  8. Set the scripts to run automatically:

    sudo defaults write com.apple.loginwindow LogoutHook /Library/Scripts/mute.sh
    sudo defaults write com.apple.loginwindow LoginHook /Library/Scripts/unmute.sh
    
  9. Close the Terminal, save data in all other apps, and reboot your machine.

  10. To undo the above actions, set defaults in a Terminal window:

    sudo defaults delete com.apple.loginwindow LogoutHook
    sudo defaults delete com.apple.loginwindow LoginHook
    

For more about Applescript commands and hooks, see this.

Microphone Mute App

All Macs have a microphone that picks up your voice and other sounds in your room.

BLAH: To mute the internal microphone on a Mac, there is NO icon among dedicated keys on the keyboard like there is for speakers. A terrible oversight because that’s just as important.

The easiest option is to get the MuteMyMicFree app by Michal Konrad Owsiak:

mac-mutemymic-39x228-7k

  1. Open a web browser to https://itunes.apple.com/pl/app/mutemymicfree/id567195825?mt=12
  2. Click View in Mac Ap Store.
  3. In the App Store pop-up, click Get, then Install app.
  4. Click Open.
  5. Click the microphone icon on the menu bar at the top of the screen:
    mac-mutemypic-icon-60x60

  6. Click the gear icon in the pop-up.
  7. Check the “Start MuteMyMic automatically during login”.
  8. Click the Quit button, the the other Quit button to dismiss the dialog.
  9. Press command+Tab to the App Store.
  10. Press Open, then Quit out the App Store.

Alternately, if you’re afraid of or cannot install downloaded apps, reduce the input volume to 0:

  1. Click on the Apple logo at the upper left corner.
  2. Select System Preferences.
  3. Type S and click on Sound.
  4. Click on the Input tab.
  5. Drag the Input volume slider all the way to the left.
  6. Close System Preferences.

This works by changing the audio input to the line-in, also known as the audio input port on your Mac. This method works as long as you don’t have any audio input device connected, such as an external microphone or some other line-in device.

Hard Drives on Mac

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.

Disk Drive Partitions

In Linux File Systems:

Drivers for an MBR (Master Boot Record) Partition Table can handle up to
2TB of disk space per partition. To list partitions:

By design MBR contains space for only 4 primary partitions. One partition can be an extended partition where logical partitions can be defined.

Drivers for a GUID / GPT Partition Table can handle up to
8 Zettabytes (ZB) of disk space per partition.

SCSI devices can have up to 15 partitions.

  1. fdisk only works on MBR.
  2. parted
  3. gdisk

The default partition type is 83 for Linux, 82 for Swap.

  1. Use mkfs to create file systems.

    NOTE: File systems include XFS, ext2, ext3, ext4, ReiserFS, Btrfs (better fs), etc.

    ext is called the “extended file system”.

Disk utilities

  1. Open a Terminal window.

  2. List partitions:

    diskutil list

    It lists physical and virtual disks:

    /dev/disk0
    #:                       TYPE NAME                    SIZE       IDENTIFIER
    0:      GUID_partition_scheme                        *251.0 GB   disk0
    1:                        EFI EFI                     209.7 MB   disk0s1
    2:                  Apple_HFS Mac SSD                 150.0 GB   disk0s2
    3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
    4:       Microsoft Basic Data Windows 8               100.1 GB   disk0s4
    /dev/disk1
    #:                       TYPE NAME                    SIZE       IDENTIFIER
    0:     FDisk_partition_scheme                        *500.1 GB   disk1
    1:                  Apple_HFS George Garside          300.2 GB   disk1s1
    2:               Windows_NTFS GRGARSIDE               199.9 GB   disk1s2
    

    "0:" and other such numbers are partitions.

    The command takes the place of the Linux lsblk commmand.

  3. Get information for a specific partition (disk0):

    diskutil info /dev/disk0

    The “Device / Media Name” is the partition label from the disk’s partition map (GPT - GUID Partition Table). disk0 Device Media Name: such as "APPLE SSD SM768E Media" is the make and model of your drive.

    Device / Media Names are set when a partition is created on a disk. The only way you could rename the “startup partition” would be to startup from another drive. The initial name is set by Apple. (which Apple does not expected people to change and does not reference them at the CLI or GUI level).

    AOTW, Apple sells SD drives up to 750.4 GB.

    Notice that disk1 is a Logical Volume on disk0s2 with a GUID referencing disk0.

  4. DOTHIS: In a Terminal window invoke:

    diskutil info /dev/disk0s2

    disk0s1: “EFI system partition”

    contains extended firmware for your drive.

  5. DOTHIS: In a Terminal window invoke:

    diskutil info /dev/disk0s1

    disk0s1: “EFI system partition”
    contains extended firmware for your drive.

    disk0s2: “Customer” to diskutil is where your files are stored.

  6. DOTHIS: In a Terminal window invoke:

    diskutil info /dev/disk1

    appears on the Desktop as "Macintosh HD" system partition, which can be changed by pressing Return key after clicking on it.

    disk0s3: “Recovery HD” is a clean install of the OS to make restoring your computer easier.

    If you add your own custom partition to the mix you will find that Apple’s tools (i.e. Disk Utility) will match the visible name and the device name.

  7. DOTHIS: Plug in a Time Machine drive.
  8. In a Terminal window invoke:

    diskutil info /dev/disk2
    

    In the list it would have 3 partitions:

    0: Apple_partition_scheme
    1: Windows_FAT_32
    2: Apple_HFS

  9. DOTHIS: Plug in a SD card.

  10. In a Terminal window invoke:

    diskutil list
    

    In the list it would have 2 partitions:

    0: FDISK_partition_scheme
    1: Windows_NTFS

  11. In a Terminal window invoke:

    diskutil info /dev/disk3
  12. DOTHIS: Plug in an external drive.
  13. In a Terminal window invoke:

    diskutil list

    In the list it would have 2 partitions:

    0: FDisk_partition_scheme
    1: Windows_NTFS Seagate Backup Plus …

  14. DOTHIS: In a Terminal window invoke:

    diskutil info /dev/disk5

    "Seagate BUP Slim SL Media"

    According to http://osxdaily.com/2014/03/20/mount-ext-linux-file-system-mac/”> http://sourceforge.net/projects/osxfuse/files/osxfuse-2.7.5/osxfuse-2.7.5.dmg/download”> OSX Fuse</p> extend OS X’s native file handling capabilities via third-party file systems such as ext4.

  15. For static information about filesystems:

    fstab
    

Hard Drive Partition Tables

DOTHIS: To show partition tables for a particular disk: In a Terminal window invoke:

sudo get show /dev/disk0

Eject the disk from the Finder (or use the unmount terminal command if you’d like). If you don’t do this, you may get a Resource busy error message during the following step.

CAUTION: Change the partition label as desired:


   sudo gpt label -i 2 -l "My New Partition Label" /dev/rdisk0
   

(replace disk0 with the relevant disk number and replace 2 with the index number.

Disk Space Usage

One of the folks at Sketch (the Mac photo-editing tool) noticed that Daisy Disk didn’t map all the disk space usage.

  1. To reveal disk usage by a file that Apple Lion uses to store copies of files to revert to any version:

    sudo du -sh /.DocumentRevisions-V100
    

    Resetting to zero would involve re-installs.

  2. If you use an alternative backup such as Dropbox, you can turn it off for a particular program:

    defaults write -app ‘sketch’ ApplePersistence -bool no
    
  3. List using a Linux command with the -Human readable flag:

    df -Hl
    

    The response:

    Filesystem                          Size   Used  Avail Capacity iused      ifree %iused  Mounted on
    /dev/disk1                          499G   339G   159G    69% 3373911 4291593368    0%   /
    localhost:/hTrfpXTlOnJhs5cpiEGZpI   499G   499G     0B   100%       0          0  100%   /Volumes/MobileBackups
    

    Alternately, there is a more verbose -human readable flag:

    df -h
    

    The response:

    Filesystem                          Size   Used  Avail Capacity iused      ifree %iused  Mounted on
    /dev/disk1                         465Gi  316Gi  148Gi    69% 3375349 4291591930    0%   /
    devfs                              256Ki  256Ki    0Bi   100%     884          0  100%   /dev
    map -hosts                           0Bi    0Bi    0Bi   100%       0          0  100%   /net
    map auto_home                        0Bi    0Bi    0Bi   100%       0          0  100%   /home
    localhost:/hTrfpXTlOnJhs5cpiEGZpI  465Gi  465Gi    0Bi   100%       0          0  100%   /Volumes/MobileBackups
    kbfs@kbfuse0                        10Gi    0Bi   10Gi     0%       0          0  100%   /keybase
    

    inodes

    Under the iused and ifree columns are the number of inode entries used and free. The total allocated of 4,294,967,279 is fixed at system creation.

Peripherals - Thunderbolt miniports

The squarish holes are thunderbolt ports for devices such as hard drives, monitors, etc. Apple sells adapters for connecting to DVI, HDMI, and VGA monitors as well as LN45 Ethernet.

The MiniDisplay Port is compatible only with Display Port compatible devices, such as an external monitor from Apple.

There are 2 squarish miniports, so you can chain up to 10 thunderbolt devices.

PROTIP: A display that isn’t compatible with Thunderbolt must be the last one in the chain.

Thunderbolt can transfer at speeds up to 20Gbps (higher speeds than USB).

USB drives

BLAH: Apple’s DVD drives don’t play Bluray videos.

To watch Bluray disks, get a Samsung external drive and software.

To list USB ports, use this Linux command:

lsusb
   

An example response for my machine:

Bus 026 Device 001: ID 8087:0024 Intel Corporation Hub 
Bus 026 Device 003: ID 05ac:8510 Apple Inc. FaceTime HD Camera (Built-in)  Serial: CC2F8K0G1JDN9KE0
Bus 029 Device 001: ID 8087:0024 Intel Corporation Hub 
Bus 029 Device 002: ID 0424:2512 SMSC Hub 
Bus 029 Device 004: ID 05ac:0262 Apple Inc. Apple Internal Keyboard / Trackpad 
Bus 029 Device 003: ID 0a5c:4500 Broadcom Corp. BRCM20702 Hub 
Bus 029 Device 005: ID 05ac:8286 Apple Inc. Bluetooth USB Host Controller 
Bus 020 Device 012: ID 045e:0040 Microsoft Corporation Microsoft 3-Button Mouse with IntelliEye(TM) 
Bus 000 Device 001: ID 1d6b:IPCI Linux Foundation USB 2.0 Bus 
Bus 000 Device 001: ID 1d6b:IPCI Linux Foundation USB 2.0 Bus 
Bus 000 Device 001: ID 1d6b:IPPT Linux Foundation USB 3.0 Bus 
   

USB-C ports

2015 Macbooks don’t come with regular USB ports so one has to buy $19 Apple proprietary adapter cables.

Another power plug runs $49

2015 Macbooks combine power and communication (Ethernet) into a single proprietary oblong rounded USB-C connector. USB-C connectors can be inserted on either side (unlike earlier USB plugs). It follows the USB 3.1 standard, which has a theoretical maximum speed of up to 10Gbps (gigabits per second) – two times faster than USB 3.0. But the Macbook is at 5Gbps for now.

3.1 support is used by Apple’s $79 HDMI/VGA connector and by upcoming MHL (Mobile High-definition Link) 3 devices to stream 4K video from mobile devices to TV sets.

Get a USB-C to USB-B cable. Plug it into a battery pack and you can charge the laptop.

  • https://www.ifixit.com/Device/MacBook_Pro_15%22_Core_2_Duo_Models_A1226_and_A1260

More on OSX

This is one of a series on Mac OSX: