Today I Learned


11 posts about #mac

Share Audio from MacOS with two Bluetooth Devices

Connect both headphones via bluetooth. Both should say connected on the Bluetooth setting page.

  1. In Finder menu hit Go -> Utilities -> Audio Midi Setup

  2. You should see both your headphones listed on the left here.

  3. Hit the “+” button at the bottom left and select “Create Multi-Output Device” (You may rename the device if you wish)

  4. Select your bose headphones from the list on the right to add to the Multi-Output Device.

  5. Right-click on the Multi-Output Device you just created and use device for sound output and play alerts and sound through this device.

  6. You may also select which device as your master device to sync across all your connected headphones.

  7. I also selected Drift Correction for slave devices - I’m not 100% sure what this does but I think it makes sure that your devices stay in sync to the audio/video playing on your computer.

  8. Watch away. Note that you won’t be able to adjust ouput volume from Macbook any more, instead volume is adjusted individually at each headphone, which is pretty neat.

Remove .DS_Store files from Mac OS X

.DS_Store files are automatically created by Mac OS X Finder in browsed directories. These files contain information about system configuration. If you upload them along with other files, the files can be misused to obtain information about your computer. For more information, see Apple security updates

Remove all DS_Store files

  1. Select Applications > Utilities to launch Terminal.

  2. Run the following UNIX command:

    sudo find / -name ".DS_Store" -depth -exec rm {} \;

  3. When prompted for a password enter your Mac OS X Administrator password.

Automatically remove DS_Store files periodically.

  1. Select Applications > Utilities to launch Terminal.

  2. Run the following UNIX command: sudo crontab -e

  3. In the vi editor, press the letter I on your keyboard once and enter the following command:

    15 1 * * * root find / -name ".DS_Store" -depth -exec rm {} \;

    This crontab entry has the following format:

    <Minute> <Hour> <DayOfMonth> <Month> <DayOfWeek> <User Command>

    The system automatically runs the command at 1:15 AM everyday. To configure the command for a different time, use different values.

  4. To save the entry, press the Esc key once, then simultaneously press Shift+Z+Z.

Set A Window To Its Default Zoom Level

Often when showing my screen to someone else or connecting to a project, I have to adjust the zoom level of my current window by hitting Cmd + a bunch of times. Once I am done I usually do some guess work to get the screen size back to what I am used to, hitting Cmd - a couple times.

There is an easier way.

Hitting Cmd 0 will return the window back to its default zoom level.

h/t Jake Worth

Run A Hardware Check

If your Mac is behaving in an odd way, there may be an issue with some piece of the hardware — such as the RAM.

You can perform a hardware check in order to chase down a diagnosis.

  • Shutdown your machine
  • Boot your machine
  • While it is booting, hold down the d key

At this point, the machine should have booted into a special hardware check mode. Select your preferred language, the hardware check will be performed, and any issues will be reported.

h/t Dillon Hafer

Require Additional JS Libraries In Postman

When writing pre-request scripts and test scripts as part of a Postman request, you aren’t limited to vanilla JavaScript. There are a handful of libraries that can be required where needed.

This short list of available libraries includes cherrio, lodash, and moment.

To pull one of these into a particular script, use the standard require feature:

var moment = require('moment');

var now = moment();

For a full list of what is available, check out Postman’s Sandbox API Reference.

Clean Up Old Homebrew Files

If you’ve been using Homebrew for a while, you may have built up some cruft in the form old and outdated files. These will not be cleaned up automatically. You have do tell Homebrew to do so. This can be done with the following command.

$ brew cleanup

This command will report what files it cleans up as well as how much disk space it was able to clear.

See man brew for more details.

h/t Dorian Karter

Default Screenshot Location

By default, Mac saves all screenshots to the desktop. If you’d like screenshots to be dumped somewhere else, you have to configure it manually from the command line. For instance, if you’d like your screenshots to be saved in the ~/screenshots directory, then enter the following commands:

$ mkdir ~/screenshots
$ defaults write location ~/screenshots
$ killall SystemUIServer